Topic: What purpose does __STDC__ serve?


Author: alisdair.meredith@uk.renaultf1.com (Alisdair Meredith)
Date: Wed, 30 Apr 2003 15:51:17 +0000 (UTC)
Raw View
Browsing the preprocessor section of the standard today I stumbled
across the following in 16.8(1) - Predefined macro names

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

This seems to place no restriction on this name whatsoever, so I wonder
why it is explicitly in the standard at all?

--
AlisdairM

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: ron@sensor.com ("Ron Natalie")
Date: Wed, 30 Apr 2003 17:36:21 +0000 (UTC)
Raw View
"Alisdair Meredith" <alisdair.meredith@uk.renaultf1.com> wrote in message news:3EAFB6CE.754CAFE5@uk.renaultf1.com...
> Browsing the preprocessor section of the standard today I stumbled
> across the following in 16.8(1) - Predefined macro names
>
> "__STDC__
> Whether __STDC__ is predefined and if so, what its value is, are
> implementation-defined."
>
> This seems to place no restriction on this name whatsoever, so I wonder
> why it is explicitly in the standard at all?

It's a C thing.   It is set to 1 to indicate a standard conforming C implementation
(from the original C90 standard).   Whether it is present or absent in a C++
compilation is up to the implementation.

Note unlike the __cplusplus flag, it doesn't convey the version of the standard.
They have a separate value for that (which didn't appear until the second version
of the standard).


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]