Experimental Physics and
| |||||||||||||||||
|
I've been doing some testing using g++ 3.2.2, here are my results: Minimum operator <? precedence ------------------------------ a <? b * c means a <? (b * c) a <? b + c means a <? (b + c) a <? b << c means a <? (b << c) a <? b < c means a <? (b < c) a <? b == c means a <? (b == c) a <? b & c means (a <? b) & c a <? b ^ c means (a <? b) ^ c Which inserts <? between == and & on the precedence table. Also: a == b <? c means (a == b) <? c a & b <? c means a & (b <? c) shows that <? isn't on the same line as either == or &. Maximum operator >? precedence ------------------------------ a >? b == c means a >? (b == c) a >? b & c means (a >? b) & c a == b >? c means (a == b) >? c a & b >? c means a & (b >? c) So this also fits between == and & and is not on the same line as either. Relative precedence and associativity ------------------------------------- a >? b <? c means (a >? b) <? c a <? b >? c means (a <? b) >? c Thus the two have the same precedence, and are left-to-right associative. This confirms experimentally the result that Noboru found by looking at the g++ source code. - Andrew -- Tongue-twister: Say "Peggy Babcock" 10 times without stumbling...
| ||||||||||||||||
ANJ, 10 Aug 2010 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |