__STDC__ and non-strictly conforming ANSI C compilers

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Dec 27 16:14:18 AEST 1988


In article <1988Dec18.043804.907 at utzoo.uucp> henry at utzoo.uucp (Henry Spencer) writes:
>(Speaking as such a software writer, I do *not* consider the suggestion
>of doing an explicit -D__STDC__=1 every time to be helpful.  I don't
>have to do this after every #define, I don't want to have to do it after
>every -D in my Makefile either.)

There must be something wrong with your Makefiles, then.
For a large project, each Makefile should contain something like
	include ../../Make.defs
(actually we use three includable pieces in our biggest project)
so that things like CC and CFLAGS can be defined IN ONE PLACE as
appropriate for the target environment:

	CC = /usr/local/bin/ansi_cc
or
	CC = cc -ANSI -D__STDC__=1	# or whatever
or
	CFLAGS = -ANSI -D__STDC__=1	# or whatever

(/usr/local/bin/ansi_cc can be a shell script that supplies the
necessary flags to enter the standard-conforming mode.)

There is a lot more one could say about such configuration, but
this should be enough to demonstrate that "cc" by itself need
not be ANSI-conforming even if it provides (part of) the way
one invokes an ANSI-conforming compiler.



More information about the Comp.std.c mailing list