TRUE and FALSE
Dan Bernstein
brnstnd at kramden.acf.nyu.edu
Fri Sep 7 08:49:16 AEST 1990
In article <1308 at mts.ucs.UAlberta.CA> userAKDU at mts.ucs.UAlberta.CA (Al Dunbar) writes:
> In article <23970:Sep505:16:2390 at kramden.acf.nyu.edu>, brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
> > In article <5398 at harrier.ukc.ac.uk> mtr at 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.
[ I point out how you can enforce this with syntax, if you're desperate ]
> ARGH! the "is_true" is understood, and redundant !
Even if you were right, that would be irrelevant ! The point of this
discussion is to please Pascal programmers. Once again, the following
should satisfy them:
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)) ...
Notice that if (flagfoo) is illegal, and there is no possible problem
along the lines of if (flagfoo == TRUE). Unless I'm mistaken, this is
what the Pascalites are looking for. (Isn't it?)
---Dan
More information about the Comp.lang.c
mailing list