Re: Handling __STDC__ on Windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 13 Jul 2005, Paul D. Smith wrote:

I have a bunch of macros in GNU make that try to determine whether the
compiler groks ANSI C, like this:

 #if defined (__cplusplus) || (defined (__STDC__) && __STDC__)

But, that doesn't work on Windows because the Windows compilers do this:

   #define __STDC__ 0

I guess the feeling is they support standard C with extensions so they
define it to 0 or something--seems silly to me but there's not much we
can do about this.


What is the autoconf-recommended, portable way to handle this?

pretty much as you've started. Write something like that in your changelog, it it'll look like other comments that I've read.

fwiw, Windows compilers aren't the only ones to do this - you should
make a habit of reading manpages.  For instance (the usual one cited)
is Solaris C.  Reading the manpage:

          a    This is the default compiler mode. ISO C plus K&R
               C compatibility extensions, with semantic changes
               required by ISO C. Where K&R C and ISO C specify
               different semantics for the same construct, the
               compiler uses the ISO C interpretation. If the -Xa
               option is used in conjunction with the -xtransi-
               tion option, the compiler issues warnings about
               the different semantics. The predefined macro
               __STDC__ has a value of 0 with the -Xa option.

(Solaris isn't the only one - leave that as an exercise ;-)

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux