Quote without comment on char constant expansion

Karl Heuer karl at haddock.ISC.COM
Wed Apr 13 03:52:55 AEST 1988


In article <4418 at hoptoad.uucp> gnu at hoptoad.uucp (John Gilmore) writes:
>[sun!sunuk!pan!aratar!chac (Chuck Clanton) writes:]
>>    #define blah(t) 't'
>>[gcc gives you 't', pcc and vcc and some others expand the argument]
>>it would seem that gcc is outvoted ... [k&r is unclear on this] ...
>>i am not sure where ansi sits on this one.  vcc and gcc both claim to be
>>ansi compatible.

gcc is right (from the ANSI view); vcc is not a conforming implementation.

>>this is from the system 5 assert.h:
>>	#define assert(EX) if (EX) ; else _assert("EX", __FILE__, __LINE__)

This will have to be fixed for the ANSI implementation of assert().

The original problem showed up in BSD <sys/ioctl.h>.  I would recommend that
this header be fixed as shown by the example below.

old> #define _IO(x,y)	(IOC_VOID|('x'<<8)|y)
old> #define TIOCHPCL	_IO(t, 2)

new> #define _IO(x,y)	(IOC_VOID|(x<<8)|y)
new> #define TIOCHPCL	_IO('t', 2)

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list