This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++0x and locale_t

On 10/1/2016 10:58 AM, Brian Inglis wrote:
On 2016-10-01 07:30, Ken Brown wrote:
I'm having an issue building icu, which boils down to the following
test case:
$ cat
#include <locale.h>
locale_t foo;
$ g++ -c --std=c++0x error: ‘locale_t’ does not name a type
 locale_t foo;
If I remove '--std=c++0x', the error goes away.  I know nothing about
C++ standards, so I don't know if this is expected behavior or if it
indicates a bug in Cygwin's headers.

For C POSIX locale_t support, you have to do one or both of:

#define _XOPEN_SOURCE   700
#define _POSIX_C_SOURCE 200809L

to support multiple dynamic C locales and related functions.
This may be done automatically if you use the default -std=gnu++03,
which may
have been the intent in ICU and original interpretation by g++.
g++ now interprets (and deprecates) c++0x to mean c++11.
You could try changing it to explicitly c++03 and see if it works,
without the
GNU extensions.
Otherwise you should change it to explicitly gnu++03, as c++0x is
and may be dropped; g++ also deprecates c++1y aka c++14 and c++1z which
may be
c++17, and their gnu++ counterparts.

I don't understand why ICU C++ would use C locales, when C is now trying
to add
a subset of features C++ has supported better, more flexibly in <locale>
over a decade; see:

for a similar problem to yours, and the solution in standard C++; and:

for an explanation of the differences between C++ and C locales.

OTOH ICU comes from IBM, and may be more interested in consistency across
languages: how else can you explain C++ methods called createInstance?

But you may just be the packager, porter, and builder, so may be unable
to fix
the implementation.

Thanks for the information.  I've submitted a patch upstream.


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]