Atomic #defines (was Re: Password checking program)

david.f.prosser dfp at cbnewsl.ATT.COM
Fri Sep 1 01:18:20 AEST 1989


In article <10867 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
>In article <13899 at bloom-beacon.MIT.EDU> scs at adam.pika.mit.edu (Steve Summit) writes:
>>	#if EOF != -2
>
>This assumes more than the standard guarantees about EOF.
>In particular, EOF might be defined as an enumeration constant.
>That's unlikely, but permitted.

My reading of the pANS says that EOF must be a macro defined in <stdio.h>.
However, the integral constant expression that EOF is replaced by may well
involve operators or operands that are not valid in #if directives.  The
pANS has certain macros whose replacement expression are required to be
valid #if expression, so this was not an oversight.

Dave Prosser	...not an official X3J11 answer...



More information about the Comp.lang.c mailing list