>In the previous example, the if statement does a boolean comparision. The if >statement can also be written as:
>if ((file_att & byte_11) == true)
>MessageBox(0, "File is Read Only", "Message", MB_OK);
This would only be correct if true were defined to have the same value as byte_11
I've found several diiferent ways that FALSE/TRUE have been defined, other than explicit definition :-
#define FALSE 0
#define TRUE (! FALSE)
logical negation, value is often compiler dependant, TRUE is sometimes 1, sometimes -1
#define FALSE 0
#define TRUE (~FALSE)
bitwise negation, TRUE is always -1
enum { FALSE, TRUE } ;
TRUE is always 1
I have to work with different compilers on different platforms, each with their own peculiarities, I rely on the fact that only FALSE is defined within C/C++ as being zero & that TRUE is not defined. Explicit comparison to TRUE is unreliable, it may work in this version of C but not in another version.
Regards
Mike
Mike
"I can live with doubt and uncertainty and not knowing. I think it is much more interesting to live not knowing than to have answers that might be wrong." - Richard Feynman