Definition of boolean type

Wade Guthrie evil at arcturus.UUCP
Tue Feb 14 02:49:20 AEST 1989


Attempting to fill the part of those called 'reader':

In article <15906 at mimsy.UUCP>, chris at mimsy.UUCP (Chris Torek) writes:
 
> 	#define FALSE 0
> 	#define TRUE ~FALSE
		/* TRUE has the bit pattern 1111 ... 1111, not 0000 ... 0001 */
> 	...
> 	/* these macros return TRUE when the queue is empty/full/... */
> 	#define ISEMPTY(eq) ((eq)->head.foo == (eq)->tail.foo)

	/* causing the macro ISEMPTY to evaluate to 1 or 0 */
 
> The code then read
> 
> 		if (ESEMPTY(eq) == TRUE) bar();
		/* 
		 * since 1111 ... 1111 never equals either 1 or 0,
		 * bar() never gets called
		 */
 
> It is left as an exercise to the reader to determine why this test
> will never call function bar().

Do I pass the test?


Wade Guthrie
evil at arcturus.UUCP
Rockwell International
Anaheim, CA

(Rockwell doesn't necessarily believe / stand by what I'm saying; how could
they when *I* don't even know what I'm talking about???)



More information about the Comp.lang.c mailing list