This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc 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]

[Bug libc/21326] C99 functions are not declared for C++11 and later if _GNU_SOURCE is not predefined by g++


https://sourceware.org/bugzilla/show_bug.cgi?id=21326

--- Comment #2 from Jonathan Wakely <jwakely.gcc at gmail dot com> ---
(In reply to Jonathan Wakely from comment #1)
> On a related topic, there is this comment in features.h
> 
> /* This is to enable compatibility for ISO C++11.
> 
>    So far g++ does not provide a macro.  Check the temporary macro for
>    now, too.  */
> #if ((defined __cplusplus && __cplusplus >= 201103L)                        
> \
>      || defined __GXX_EXPERIMENTAL_CXX0X__)
> # define __USE_ISOCXX11 1
> #endif
> 
> Should it define some other macro? Isn't __cplusplus the right thing to
> check?

If you're expecting something like __STDC_VERSION__ for C++, that's exactly
what __cplusplus is, so I don't know what "So far g++ does not provide a macro"
means.

However, that reminds me of another alternative solution to the main problem,
G++ could predefine __STDC_VERSION__ to 19901L for C++11 and C++14, and to
201112L for C++17. That would cause glibc to declare the C library functions
that C++ wants.

The C++ standard says:

"Whether __STDC_VERSION__ is predefined and if so, what its value is, are
implementation-defined."


So it would be OK for G++ to do that, as a way of requesting libc to declare
the corresponding features.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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