ANSI C -- site identification

Doug Gwyn gwyn at brl-smoke.ARPA
Tue Dec 16 05:47:46 AEST 1986


In article <110 at decvax.UUCP> minow at decvax.UUCP (Martin Minow) writes:
>Page 82, line 34. Many, if not all, existing implementations pre-define
>implementation-specific preprocessing variables that specify the processor,
>operating system, and, in some cases, the compiler name.  For example, Decus
>C predefines ``pdp11'', ``decusc'', and either ``rt11'' or ``rsx.''  For
>better or for worse, this tradition is almost ten years old.  Some provision
>should be made for this in Standard C.

I missed the discussion on this, so I can't tell you why it's
specified the way it is, other than perhaps to avoid unpleasant
surprises such as:
	int	sun;	/* struct or union flag */
	int	sel;	/* selection value */
both of which get mangled by pre-#defines that I'm aware of.

There has been a suggestion made that such pre-defined names
could be handled in a special way, to avoid this kind of problem,
but so far I haven't seen a really appealing proposal for this.

>     __PROCESSOR__	defines the processor that the compiler is
>			targetted for.

The problem with such things is that they are only useful if
there is standardization of the "official" formats and lists
of possible values.  It is definitely outside the scope of
X3J11 to set up such schemes.



More information about the Comp.lang.c mailing list