https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67195

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jeffrey Walton from comment #5)
> When I parsed the page on macros, I found it to be an interesting
> implementation detail. And I thought it was useful to know cpp or g++
> fetched the macro from c++config.h. (A related factoid is LLVM uses
> <ciso646>).

Technically it uses <__config>, which is its equivalent of our
<bits/c++config.h>. The reason they suggest including <ciso646> is that it's a
public header that does nothing except include the internal implementation
header <__config>.

> But because I was not explicitly told to include c++config.h or another
> standard library header for the define, I did not make the leap it was a
> requirement.
> 
> For me (naively), 'cpp' or 'g++ -dM' provide the preporcessor macros used to
> compile a source file, and the way they are delivered to me is
> indistinguishable from magic.

But for us it is done using sufficiently advanced technology not magic, and
that technology is a header file.

Since you could in theory be using g++ with a different standard library
implementation other than libstdc++ it would make no sense for g++ to define
the libstdc++ macros, and would be completely wrong! They have to come from the
library itself because only once you include a library header file is it known
which library you are using.

Reply via email to