Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BOOL Datatype
Message
From
11/04/2000 10:54:01
 
 
To
10/04/2000 16:23:47
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00357504
Message ID:
00358047
Views:
12
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform