Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

small patch for codecompletion

(1/1)

frithjofh:
just a small path cleaning up a conditio in the line of

!A || (A && B)

is really the same as

!A || B

yvesdm3000:
Beware of this construct. There are no precedence rules for logical operations so the compiler can choose to make

!A  || B && C

into

!(A || B&&C)

or

(!A) || B && C

Been bitten by this myself before... It looks like compilers even take a space into account and treat it differently if there is a space between the ! and A or not.

Yves

frithjofh:
the standard does give precedence rules for logical operators...

it states clearly that the logical not is of higher precedence than && and this higher than ||

it would have to be a bad implementation of the compiler

and remark the parenthesis too. they are like that in the code. this is not about left tor right or right to left ordering...

but, heck, maybe I am wrong ... I'll stand corrected gladly

thx for the feedback

oBFusCATed:
Of course there are precedence rules in C++ also there is early exit in conditionals.

http://en.cppreference.com/w/cpp/language/operator_precedence

ollydbg:
The patch is in trunk now, thanks.

Navigation

[0] Message Index

Go to full version