-----Non-member submission----- From: Will Adams [mailto:wadams@freescale.com] Sent: Friday, July 28, 2006 9:02 AM It seems the fix for the definition of the conditional operator is to replace `logical equality comparison of expression1 with zero' with `logical inequality comparison of expression1 with zero'. will Bresticker, Shalom wrote: > Note that in 1364-2001, the description of ?: was not reversed. It was > ambiguous, but not reversed. For a description of how and why it was > changed, see http://boyd.com/1364_btf/report/full_pr/403.html . > > Shalom > > >> I do agree that the description of the condition evaluation in 5.1.13 >> appears to be reversed. >> >>> On the evaluation of the conditional operator, IEEE 1364-2005, > section >>> 5.1.13 `Conditional operator', states the following. >>> >>> conditional_expression ::= (From A.8.3) >>> expression1 ? { attribute_instance } expression2 : expression3 >>> expression1 ::= expression >>> expression2 ::= expression >>> expression3 ::= expression >>> >>> The evaluation of a conditional operator shall begin with a > logical >>> equality comparison (see 5.1.8) of expression1 with zero, termed >> the >>> condition. If the condition evaluates to false (0), then >> expression3 >>> shall be evaluated and used as the result of the conditional >>> expression. If the condition evaluates to true (1), then >> expression2 >>> is evaluated and used as the result. If the condition evaluates > to >> an >>> ambiguous value (x or z), then both expression2 and expression3 >> shall >>> be evaluated; and their results shall be combined, bit by bit, >> using >>> Table 5-21 to calculate the final result unless expression2 or >>> expression3 is real, in which case the result shall be 0. >>> >>> I am not sure why this defines `condition' as `a logical equality >>> comparison of expression1 with zero', since this means that >> `condition' >>> is the negation of `expression1' (`expression1 == 0' is 1 when >>> `expression1' is 0, 0 when it is 1, and X when it is X or Z), and, >>> applying the rest of the definition, when `expression1' is 1, >>> `condition' is 0, and so `expression3' is evaluated as the result of >> the >>> conditional expression. Similarly, if `expression1' is 0, then >>> `expression2' is evaluated as the result of the conditional >> expression. >>> This seems to give the semantics of an `if else then' operator, > rather >>> than an `if then else', which I doubt is what is intended. >Received on Fri Jul 28 09:51:50 2006
This archive was generated by hypermail 2.1.8 : Fri Jul 28 2006 - 09:52:00 PDT