Topic: From C++ to Shining C (bool)
Author: aeb@lamb.saltfarm.bt.co.uk (Tony Bass)
Date: 1995/07/21 Raw View
Author: diamond@jrd.dec.com (Norman Diamond)
Date: 1995/07/20 Raw View
In article <DBv64J.3r8@research.att.com>, ark@research.att.com (Andrew Koenig) writes:
>In article <3u1113$pjs@fido.asd.sgi.com> shankar@engr.sgi.com writes:
>> I guess the intent was that implementations can quietly implement bool as
>> "unsigned char" and do nothing else, but that's clearly silly, since they
>> would still have to guard against 256 ++'s in a row.
>The intent is to allow programmers who use int values as booleans
>and set them to true by applying ++ to them to change them to type bool
>without changing alll the places they're used.
>Wise or not, the practice of using ++ to make a variable "true"
>is widespread.
Wise and/or not, the practices of using printf() and malloc() without
bothering to #include relevant headers or declare them also used to be
widespread. The C standard could have allowed C programmers to continue
these lazy practices as well, only causing nuisances to implementors and
not even costing execution time, but it didn't.
I think I have to agree with someone else's posted opinion, this issue
best shows how C++ is being made as ugly as possible.
--
<< If this were the company's opinion, I would not be allowed to post it. >>
"I paid money for this car, I pay taxes for vehicle registration and a driver's
license, so I can drive in any lane I want, and no innocent victim gets to call
the cops just 'cause the lane's not goin' the same direction as me" - J Spammer
Author: mike@if.com (Mr.H)
Date: 1995/07/20 Raw View
It seems to me that the problem almost everyone is having with
allowing ++ and -- operations on bool values has to do with the
effect that creating a built-in boolean type will have on existing
code. What about this: call the boolean type something other than
'bool' or 'boolean'. Don't ask me what, I don't get paid for that.
If the name were changed, let's call it 'foo' for the sake of argument,
then the vast majority of code out there could continue to use existing
conventions and header files. That code would not break. On the
other hand, those who wish to begin using a built-in, supported boolean
type could re-write or begin new implementations using foo from the
get go. The standards committee would be free to impose whatever
limited set of operators that truly makes sense for the type, and
nobody (at least very few people) would run into broken code by
accident. Thoughts?...
--
-------------------------------------------------------------------
-- Mr.H - mike@mrhappy.if.com --
-- All opinions expressed herein are my own... right? --
-- "Things are more like they are now than they have ever been." --
-- - Gerald Ford --
-------------------------------------------------------------------