Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!jyegiguere From: jyegiguere@watmath.UUCP Newsgroups: comp.lang.c Subject: Re: Defining TRUE and FALSE Message-ID: <13891@watmath.UUCP> Date: Sat, 11-Jul-87 23:03:35 EDT Article-I.D.: watmath.13891 Posted: Sat Jul 11 23:03:35 1987 Date-Received: Sun, 12-Jul-87 16:13:52 EDT References: <13851@watmath.UUCP> <7460@elsie.UUCP> Reply-To: jyegiguere@watmath.waterloo.edu (Eric Giguere) Organization: U. of Waterloo, Ontario Lines: 27 Keywords: true, false, boolean There have been some interesting comments, all valid. Yes, in a proper implementation #define TRUE 1 #define FALSE 0 should work properly. The solution I offered was one that should guarantee portability. The use of an enumeration typedef enum { FALSE, TRUE } bool; is fine as long as you're sure that your programs will only be used on systems that support enumerations. (Thankfully, most of them do support it.) I think, however, that lint is pretty picky if it flags an expression of the form i = ( 0 == 0 ); which is perfectly valid if you read the grammar to the language. Any decent compiler will simply fold this value into the appropriate constant value. ------------------------ Eric Giguere