Eric Blake <ebl...@redhat.com> writes:
> On 04/26/2012 09:02 AM, Vincent Lefevre wrote:

>> Almost no compilers/systems are compliant to C99. For instance, under
>> Linux, GCC defines "unix" and "linux" to 1, while they are not
>> reserved.

> Even when in --std=c99 mode?

That, or -ansi, make GCC and glibc compliant, but almost no one uses them.
The experience of trying to use them with a large project will quickly
show why.  It's almost impossible to get the right set of feature-test
macros defined to let the code build without causing other strange
problems on other platforms, due to bugs in their strict standard
compliance mode or due to other weirdness (try, for example, requesting
_XOPEN_SOURCE 600 on Solaris, and you'll find you have to go to some
lengths to ensure that the source code and the compiler are configured for
consistently using the same standard or the system header files will throw
fatal errors and abort the compile).

I've done the experiment from time to time of supporting -ansi or
--std=c99, but even for small code bases I consider it the kind of thing
that one does as a hobby or out of curiosity.  It's not a very good way to
actually get work done and write code that is portable on a practical
level (meaning that people on multiple UNIX platforms can just run
./configure && make).

-- 
Russ Allbery (r...@stanford.edu)             <http://www.eyrie.org/~eagle/>

Reply via email to