On 08/28/14 07:18, Tim Lewis wrote: > It appears that this should prevent the display of the text statement. > However, to my surprise, it works on NT32. Per operator precedence, it > should be 8|8 is 8, and 8 == 8 is TRUE. > > > > suppressif 8|8 == 0x8; > > text > > help = STRING_TOKEN(STR_BITWISE_OR_HELP), > > text = STRING_TOKEN(STR_BITWISE_OR_PROMPT); > > endif; > > > > The equivalent 8&8 == 0x8 has no problem.
I must disagree. In the C language, both operator & and operator | bind *less* strongly than operator ==. In 6.5 Expressions p3 it says The grouping of operators and operands is indicated by the syntax. (footnote 74). [...] Footnote 74 says The syntax specifies the precedence of operators in the evaluation of an expression, which is the same as the order of the major subclauses of this subclause, highest precedence first. [...] And 6.5.9 Equality operators Syntax 1 equality-expression: relational-expression equality-expression == relational-expression equality-expression != relational-expression [...] 6.5.10 Bitwise AND operator Syntax 1 AND-expression: equality-expression AND-expression & equality-expression Hence "equality-expression" is a stronger binding than "AND-expression". Then, 6.5.11 Bitwise exclusive OR operator Syntax 1 exclusive-OR-expression: AND-expression exclusive-OR-expression ^ AND-expression [...] 6.5.12 Bitwise inclusive OR operator Syntax 1 inclusive-OR-expression: exclusive-OR-expression inclusive-OR-expression | exclusive-OR-expression Hence "equality-expression" is a stronger binding than "inclusive-OR-expression", transitively, via "AND-expression" and "exclusive-OR-expression". So, at least in C (not sure about the VFR language), 8|8 == 0x8 means 8|(8 == 0x8) means 8|1 means 9 This compares unequal to zero, so in a "truth" context, it means "true". As I understand, you don't see that (ie. even though the binding is different from what you assumed, the end result should coincide with your expectation, but it doesn't happen.) Maybe there's a bug in the form engine that uses "== 1" rather than "!= 0" for truth checks. Then, 8&8 == 0x8 means 8&(8 == 0x8) means 8&1 means 0 which is "false" (independently of whether the form engine otherwise uses the correct "!= 0" form, or the incorrect "== 1" form). Thanks Laszlo ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel