Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!rutgers!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.c Subject: Re: TRUE and FALSE Message-ID: <23970:Sep505:16:2390@kramden.acf.nyu.edu> Date: 5 Sep 90 05:16:23 GMT References: <5398@harrier.ukc.ac.uk> Organization: IR Lines: 20 In article <5398@harrier.ukc.ac.uk> mtr@ukc.ac.uk (M.T.Russell) writes: > To the people complaining about `if (x == TRUE)': YOU ONLY USE `TRUE' AND > `FALSE' FOR ASSIGNMENT AND PARAMETER PASSING. It's a fairly simple rule. It is wise to take advantage of the language's syntax to remind the programmer of this at every turn. If I were really desperate for this type: typedef struct { int truth; } truefalse; #define set_true(b) ((void) ((b)->true = 1)) #define set_false(b) ((void) ((b)->true = 0)) #define is_true(b) ((b).true) Usage: truefalse flagfoo; set_true(&flagfoo); if (is_true(flagfoo)) ... Somehow in real programs I've never had trouble with declaring variables flagthis, flagthat, flagtheotherthing. The ``flag'' alerts the reader. Flags are multi-valued when I need to express different shades of truth. ---Dan