Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!ut-sally!husc6!cca!mirror!ima!haddock!karl
From: karl@haddock.ISC.COM (Karl Heuer)
Newsgroups: comp.lang.c
Subject: Re: Defining TRUE and FALSE
Message-ID: <764@haddock.ISC.COM>
Date: Mon, 20-Jul-87 16:53:26 EDT
Article-I.D.: haddock.764
Posted: Mon Jul 20 16:53:26 1987
Date-Received: Wed, 22-Jul-87 01:35:37 EDT
References: <13851@watmath.UUCP> <632@itsgw.RPI.EDU> <13259@topaz.rutgers.edu> <6123@brl-smoke.ARPA> <208@vianet.UUCP>
Reply-To: karl@haddock.ISC.COM (Karl Heuer)
Organization: Interactive Systems, Boston
Lines: 21
Keywords: boolean, true, false

In article <208@vianet.UUCP> devine@vianet.UUCP (Bob Devine) writes:
>In article <6123@brl-smoke.ARPA>, gwyn@brl-smoke.ARPA (Doug Gwyn ) writes:
>> Yucky!  The principle "say what you mean" implies that "flag = TRUE;"
>> is much better than "flag++".
>
>[But] doing it with a test allows a easy check for multiple use of a option.
>    if (W_flag++) ...

One problem with this is that it's possible to overflow, the most likely case
being if you implement boolean with "char" and execute this statement 256
times.  (I know your example contained an "exit", but I'm thinking about the
general case.)

I agree with Doug.  I never use boolean "++" in my own code anymore, for the
reason he states and also because the notation is misleading: it suggests that
"--" can be used symmetrically as set-to-FALSE.

I'd rather have a true boolean datatype in the language, with "++" and "--"
defined as Set and Clear, respectively.  I've done this in C++.

Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint