Open main menu

CDOT Wiki β

Changes

C/C++ FAQ

64 bytes added, 17:52, 5 November 2012
C/C++ FAQ
'''A:''' The evaluation of expressions, especially arithmetic expressions are based on sequence points which are undefined by the language. Arithmetic expressions containing complex postfix calculations are evaluated differently across different compilers because each compiler is unequally efficient. That is to say, these expressions are not portable as each compiler uses a different way to evaluate the expression based on its efficiency implementation. This can be noted by observing the process time of an expression across different platforms, which will be different for the same expression, due to different methods of evaluation. <br>
* Q: Where is the source of your information regarding sequence points and implementations used by different compilers? (pliu)
* A: I learnt it in high school, not sure if there is a source.
For example, consider the following snippet:
<source lang="cpp">