Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BOOL Datatype
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00357504
Message ID:
00358053
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,

Thanks. I forgot about defining it as an enumerated type. That makes sense too.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform