Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Although this code performs as expected, it still represents poor practice by writing to number three times in a single expression.

Code Block
bgColor#ccccff#ffcccc
int number = 17;

number = ((31 * ++number) * (number=get())) + (number > threshold[0]? 0 : -2);

...

CERT C Secure Coding Standard

EXP30-C. Do not depend on order of evaluation between sequence points

CERT C++ Secure Coding Standard

EXP30-CPP. Do not depend on order of evaluation between sequence points

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="9d1ae5b8a30524e0-a8c24b9d-483c4c44-90a78f05-1e7a23046c9ab26a152673c4"><ac:plain-text-body><![CDATA[

[ISO/IEC TR 24772:2010

http://www.aitcnet.org/isai/]

"Side?effects and Order of Evaluation [SAM]"

]]></ac:plain-text-body></ac:structured-macro>

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7d93256a96d0924b-ad92caad-44384164-8b5eb344-752fda6f13be330974fc338a"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#JLS 05]]

[§15.7, "Evaluation Order"

http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.7]

]]></ac:plain-text-body></ac:structured-macro>

 

§15.7.3, "Evaluation Respects Parentheses and Precedence"

...