[Gambas-user] strange problem with NOT
Jean-Francois Perreault
cmcpero at ...142...
Fri Mar 18 20:45:11 CET 2005
IF 1 THEN
IF NOT 1 THEN
IF NOT (1) THEN
all return true
but NOT CBool(1) returns false
I think (in VB at least) AND OR XOR and NOT should all have lower
precedence (executed after) than (=,>,<,>=,<=,<>)
this page disagree with me , but this is for C++
http://www.intap.net/~drw/cpp/cpp03_05.htm
but this page from MSDN , about VB.NET says that NOT and the other
logical and bitwise operators have lower precedence the comparison and
arithmetic operators
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vagrpOperatorPrecedence.asp
(what the hell is AndAlso and OrElse ?! ... never heard of those before)
I'm pretty sure this is similar behavior to VB6
(
btw there is an unrelated example of overloading DIM , like this
Dim A, B, C, D, E, F, G As Double
that would be another great thing to have
unspecified types are the same as the last but
you can explicitely specify each one , it just makes the code more
compact and readable
... what happens with Dim A, B, C as Interger, D as NEW Checkbox, E as
Double ?
oh well..
)
Rob wrote:
>On Friday 18 March 2005 13:51, Jean-Francois Perreault wrote:
>
>
>>it's as if NOT was a function NOT() and not a logic keyword !
>>
>>
>
>Actually, it's as if NOT had a lower operator precedence than the
>equals sign, which could very well be the case. This is why I use
>parens all over the place in my expressions.... can never remember
>between different languages what the different operator precedences
>are.
>
>Though I have no idea without firing up Gambas what "not 1" evaluates
>to.
>
>Rob
>
>
>
>
>
>-------------------------------------------------------
>SF email is sponsored by - The IT Product Guide
>Read honest & candid reviews on hundreds of IT Products from real users.
>Discover which products truly live up to the hype. Start reading now.
>http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>_______________________________________________
>Gambas-user mailing list
>Gambas-user at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
>
>
More information about the User
mailing list