Atomic #defines (was Re: Password checking program)

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Aug 18 01:23:03 AEST 1989


In article <13569 at bloom-beacon.MIT.EDU> scs at adam.pika.mit.edu (Steve Summit) writes:
>In article <652 at lakart.UUCP> dg at lakart.UUCP (David Goodenough) writes:
>>1. Use <stdio.h>, and EOF, because there are no guarantees that EOF has to be
>>	-1: I could use -42 if the spirit so moved me.
>Is this true?

Yes; EOF can be defined as any int value that differs from all
possible char values.

>	#define ERROR (EOF-1)

Don't do this.  You don't know what EOF might be defined as, so
this might not work right.

EOF belongs to the C implementation.  Invent your own symbols for
your own uses.



More information about the Comp.lang.c mailing list