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:
00358086
Views:
18
>If FALSE is defined as zero, NOT FALSE or TRUE should be its exact opposite.
>Using one bit, the exact opposite (bitwise compliment) of 0 would be 1.
>Extendeding it to a byte:

>0000 0000 - FALSE
>1111 1111 - TRUE (or -1)

>However,

>0000 0000 - FALSE
>0000 0001 - TRUE

Depends on whether your NOT operator is logical or bitwise, hence the different operators for AND (&, &&), OR (|, ||) & NOT (~, !). As TRUE & FALSE are logical results, then I would assume ! had been used for the negation of FALSE. At least in the original of Stroustrup's books on C++, then the result should be 1. But I have seen several (older) C compilers return -1 for TRUE.

My view is that if you are concerned with the value of TRUE, then you are likely to be doing something dubious. I have occassionally come across code like

int add_subtract( int val1, int add, int val2 )
{
return( val1 + add * val2 ) ;
}

called with
x = add_subtract( 10, TRUE, 5 ) ;
y = add_subtract( 10, FALSE, 5 ) ;

(ok simplified example, but you get the drift, when the code was ported to a different compiler, the results of x & y were mysteriously swapped & it took a good while to find the reason why).

Regards
Mike

P.S. did you see my query in the chatter section, on how to get auto-quote working, may be that wasn't the right place to send it, but how do you get it to work ?
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