home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!pmafire!news.dell.com!natinst.com!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!mksol!mccall
- From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
- Subject: Re: New C++ type: boole
- Message-ID: <1992Jul27.135243.28686@mksol.dseg.ti.com>
- Organization: Texas Instruments Inc
- References: <DOUGM.92Jul26200316@titan.cs.rice.edu> <9220914.11530@mulga.cs.mu.OZ.AU>
- Date: Mon, 27 Jul 1992 13:52:43 GMT
- Lines: 48
-
- In <9220914.11530@mulga.cs.mu.OZ.AU> fjh@mundil.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
-
- >The following is actually from Deviasse Robert N <a228devi@cdf.toronto.edu>.
- >I am posting it for him, since he does not have write access to the net.
- >Disclaimer: if you don't like it, blame him! :-)
-
- > Fergus.
-
- >========================== PROPOSAL FOLLOWS =============================
-
- >Actually there is a general way of adding a boole type without breaking any
- >C++ code. Every DOS compiler I've used (and a few UNIX ones) already give
- >warning for code such as "if (ch=getchar()) /*...*/;". Such warnings could
- >easiliy be made manditory in the standard, or the standard could reserve
- >a pragma that does this type of checking, though the implementation may
- >choose not to implement it.
-
- NO! Do *NOT* make this warning mandatory. Some of us prefer to write
- code like this on purpose. Accidently using '=' where I meant '=='
- has never been a problem for me, and I find 'if (x=f(z))' to be a much
- more concise statement of what I want (if f(z) returns a zero or null
- pointer, do the body of the if; whatever happens, assign the returned
- value to z) than having to parenthesize and then add an explicit
- comparison to 0 for the 'if'.
-
- This is one warning that I always turn off in PC compilers. Pure
- annoyance.
-
- >I think that most people would like to have a boolean type in C++, although
- >most people have resigned themselves to thinking that boolean types
- >cannot easily be added to C++.
-
- The only 'advantage' I can see to a 'real' boolean type is if you can
- guarantee me that it will only take up one bit and the compiler is
- bright enough to store them all off in some bit array someplace to
- save space. Otherwise, I guess I fail to see any pressing need for
- this.
-
- I think there are a lot better ideas than this to expend effort on
- (things like real subrange types, for example, which would allow
- 'bool' to be implemented as a subrange from 0..1, for folks who really
- feel like the need bool).
-
- --
- "Insisting on perfect safety is for people who don't have the balls to live
- in the real world." -- Mary Shafer, NASA Ames Dryden
- ------------------------------------------------------------------------------
- Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
-