ANSI C token set (including $ and @)

Larry Jones scjones at sdrc.UUCP
Thu Jan 19 08:47:19 AEST 1989


In article <1989Jan16.204214.15979 at utzoo.uucp>, henry at utzoo.uucp (Henry Spencer) writes:
> In article <11383 at haddock.ima.isc.com> karl at haddock.ima.isc.com (Karl Heuer) writes:
> >`Strictly conforming' is an attribute of programs, not implementations.  An
> >implementation is either ANSI C, or it isn't.  According to the rules,
> >accepting `$' in an identifier seems to yield a non-ANSI implementation.
> 
> Only if it is not diagnosed (e.g. by a warning message).  I'm getting a
> bit tired of repeating this:  accepting extensions does not make a compiler
> non-conforming.  The requirements for a conforming implementation are that
> it handle all strictly conforming programs correctly, and that it diagnose
> (not necessarily reject, just diagnose) any construct which is illegal
> according to the standard.

That's what I thought, too.  But Karl pointed out to me that is
is possible to write a strictly conforming program that will NOT
be interpreted correctly by an implementation that allows '$' in
identifiers.  All you need do is something like:

	#define foo$bar
	#ifdef foo
	.
	.
	.
	#endif

The standard requires the #ifdef to be true, but any
implementation that allows '$' in an identifier will evaluate it
as false.

----
Larry Jones                         UUCP: uunet!sdrc!scjones
SDRC                                      scjones at sdrc.UU.NET
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150                  AT&T: (513) 576-2070
"When all else fails, read the directions."



More information about the Comp.std.c mailing list