Do these two source file(i.e. include\c_std\cstdlib and include\c_global\cstdlib) serve for different purposes whereas they contain similar content?

Jonathan Wakely
Thu Aug 13 13:24:04 GMT 2020

On 13/08/20 09:06 -0400, wrote:
>Quoting Jonathan Wakely via Libstdc++ <>:
>>On 12/08/20 20:15 +0800, 孙世龙 sunshilong via Libstdc++ wrote:
>>>Hi, list
>>>These two source files (i.e. include\c_std\cstdlib and
>>>include\c_global\cstdlib) have almost same content.
>>>What is their own role?
>>>Do these two source files serve for different purposes whereas they
>>>contain similar content?
>>You can ignore the c_std one.
>>The headers in that directory are only used if you build gcc with
>>--enable-cheaders=c_std but nobody does that, and they aren't properly
>>maintained any more, and they probably don't work.
>To answer the first question, the c_std and c_global set up was to 
>accommodate the fact that some target systems had C++ support in their 
>libc system headers by putting symbols in the std:: namespace 
>requiring their symbols to be hoisted into the global namespace in the 
><c...> headers (the c_std strategy), and some had only support for the 
>C language and all their symbols were already in the global namespace 
>(the c_global strategy).  I don't believe any of the former systems 
>(eg. Solaris 8) are supported by GCC any more.

But if you look at the include/c_std/ headers, they all pull symbols
from the global namespace into namespace std ... exactly like the
c_global ones.

I agree that the intended behaviour was what you describe, but I don't
think it ever actually worked, and I don't think any targets using
--enable-cheaders=c_std have ever existed.

>To answer the second question, no they serve the same purpose but for 
>different targets, and which set of headers get used is selected at 
>configuration time.

More information about the Libstdc++ mailing list