Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!pt.cs.cmu.edu!pt!dld
From: dld@F.GP.CS.CMU.EDU (David Detlefs)
Newsgroups: comp.lang.c++
Subject: Re: Time to standardize "true" and "false"
Message-ID: 
Date: 25 Sep 89 20:49:56 GMT
References: <13730@well.UUCP> <9464@attctc.Dallas.TX.US> <2142@dataio.Data-IO.COM>
Distribution: comp
Organization: CMU CS Department
Lines: 31
In-reply-to: bright@Data-IO.COM's message of 25 Sep 89 18:40:48 GMT

Several of the posts on this subject have been of the form "why bother
if you've already got the int type that does everything you want?"
I kind of agree, but I kind of don't: I think you would only really
gain something if you really went for it and made Bool (or whatever)
part of the language.  Specifically:

1) "If," "while," "for," and "do" statement tests would require a boolean.
2) Relational operators (==, >, &&, etc) would return a boolean.

I think this might result in measurably safer programs.  Just think,
errors of the form

   if (i = 0) ...

would become errors.  (I'm assuming that there is no implicit
conversion between int and boolean.)

If you don't take the full step (and I have no hope of this actually
happening; there are probably good reasons not to do this.  Like
backwards compatibility) then it's probably not worth doing.

Ah well.

Dave


--
Dave Detlefs			Any correlation between my employer's opinion
Carnegie-Mellon CS		and my own is statistical rather than causal,
dld@cs.cmu.edu			except in those cases where I have helped to
				form my employer's opinion.  (Null disclaimer.)