Re: Application crashes on BitBlt after a while.. need help please
"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel messaggio
news:8vsq34h2m98kc6ejb7in4s7avmu5l5ggju@4ax.com...
THIS CODE IS WRONG! There is no reason to assume that the value returned
is TRUE. I
have NO IDEA why people cannot conceive of the fact that a Boolean value
is a Boolean
value and DOES NOT NEED TO BE COMPARED TO A BOOLEAN LITERAL!!!!!
[...]
AS SOON AS YOU WRITE ==TRUE or ==FALSE, IMMEDIATELY SAY "I AM MAKING A
SERIOUS CODING
ERROR HERE!" and replace it with a test on the boolean value.
Considering some APIs like SetPixelFormat (I used that to do some OpenGL
rendering), that returns BOOL:
SetPixelFormat
http://msdn.microsoft.com/en-us/library/ms537559(VS.85).aspx
The *official* MSDN documentation clearly says:
<quote>
Return Values
If the function succeeds, the return value is TRUE.
If the function fails, the return value is FALSE.
</quote>
So, I would be less agressive with the OP. Because, if the OP reads the
documentation, he is doing nothing wrong, IMO.
That said, I myself tend to compare using if ( ok ) or if ( !ok ), but it is
a matter of personal style (I like less typing :)
But the MSDN official documentation is very clear...
Giovanni