[v3] default to --disable-long-long, ctype fixes

Rob Taylor robt@flyingpig.com
Thu Dec 21 08:28:00 GMT 2000


> The problem is
> when a user does something like
>
> #include <stdlib.h>
> #include <cstdlib>
>
> and compiles like "g++ foo.cc"
>
> What happens: stdlib.h is parsed without ISO-C99  features, then cstdlib
> is parsed, expecting ISO-C99 features from stdlib.h, including things like
> lldiv_t. This is incorrect, and results in a compile-time failure.
> This is bad.

This is still slightly hacky but does pose a possible solution: have the
detection for ISO-C99 functions wrapped by #if defined(__GLIBC__) &&
defined(_GNU_SOURCES) , or whatever works best - you get the idea. How does that
sound, is it possible?
so if you haven't got -D_GNU_SOURCES and you do

> #include <stdlib.h>
> #include <cstdlib>

then you'll end up without the ISO-C99 stdlib functions, but will still be able
to use the long long type.

Rob

(p.s. or above s/_GNU_SOURCES/_ISOC99_SOURCES)



More information about the Libstdc++ mailing list