Re: OnPaint & BMP question
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Wed, 26 Oct 2005 21:43:56 -0400
No, what I mean is if you have a bool or BOOL, you just USE it!
Example
BOOL b;
if(b)
that's it. A boolean value is either true or false. COMPARING to true or false is silly
and redundant. It is exactly the same as my example about compare. Writing
if(b == false)
is as silly as writing
if((a < 0) == false)
if you want to check for b being false, write
if(!b)
the same as you would properly write
if(a >= 0)
I find the habit of comparing booleans to false or true to be one that any number of
programmers have picked up, for reasons that can make no sense. It is a particularly
execrable style. Anyone who teaches it is not in touch with reality, or has so badly
misunderstood the concept of "boolean" that they should stop teaching (if they can't get a
concept this simple right, what else are they doing wrong?)--and I have been told by one
correspondent that he had been "taught that this is the right way". It isn't.
joe
On Mon, 24 Oct 2005 16:50:43 GMT, "Jona Vark" <noemail@xxxxxxx> wrote:
>
>"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
>news:lqaol1dv7uvktj61uho6fj4hti6fvtiioa@xxxxxxxxxx
>
>>>You should also avoid ever writing ==false or ==true; it is as silly as
>writing
>>>if( a > b == true)
>boolean values stand for themselves, and should never be compared to true or
>false (and it
>is usually a fatal mistake to compare a BOOL == TRUE).
>
>Are you saying to compare them to 1 & 0 instead? false/true have always
>worked ok.. don't find that silly actually.
>
>
>>>means you can write "." instead of the uglier "->" everywhere in the body.
>
>I'm actually laughing now, joe.
>
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- References:
- OnPaint & BMP question
- From: Jona Vark
- Re: OnPaint & BMP question
- From: Joseph M . Newcomer
- Re: OnPaint & BMP question
- From: Joseph M . Newcomer
- Re: OnPaint & BMP question
- From: Jona Vark
- Re: OnPaint & BMP question
- From: Joseph M . Newcomer
- Re: OnPaint & BMP question
- From: Jona Vark
- OnPaint & BMP question
- Prev by Date: Re: How to evaluate a persons skills in vc
- Next by Date: Re: OnPaint & BMP question
- Previous by thread: Re: OnPaint & BMP question
- Next by thread: Re: return stream of bytes in COM
- Index(es):
Relevant Pages
|