Versions Compared

Key

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

...

EXP00-EX1: Mathematical expressions that follow algebraic order do not require parentheses. For instance, in the expression

Code Block
x + y * z

the multiplication is performed before the addition by mathematical convention. Consequently, parentheses to enforce this would be redundant.

...

Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

EXP00-C

low

probable

medium

P4

L3

Automated Detection

...

Tool

Version

Checker

Description

Section

LDRA tool suite

...

Include Page
c:LDRA_V
c:LDRA_V

 

 

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Other Languages

Related Guidelines

This rule appears in the C++ Secure Coding Standard as : EXP00-CPP. Use parentheses for precedence of operation.

Bibliography

Wiki Markup
\[[Dowd 062006|AA. Bibliography#Dowd 06]\] Chapter 6, "C Language Issues" (Precedence, pp. 287—288)
\[[ISO/IEC 9899:1999|AA. Bibliography#ISO/IEC 9899-1999]\] Section 6.5, "Expressions"
\[[ISO/IEC PDTR 24772|AA. Bibliography#ISO/IEC PDTR 24772]\] "JCW Operator precedence/Order of Evaluation"
\[[Kernighan 881988|AA. Bibliography#Kernighan 88]\] 
\[[MISRA 042004|AA. Bibliography#MISRA 04]\] Rule 12.1
\[[NASA-GB-1740.13|AA. Bibliography#NASA-GB-1740.13]\] Section 6.4.3, "C Language"

...