Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
13.3 What not being evaluated means?
#1
Hi there,

Rule 13.3 says:
Quote:All sub-expressions of the full expression are treated as if they were evaluated for the purposes of this rule, even if specified as not being evaluated by the C Standard.

I understand what it makes sense in the context for instance of the conditional operator, but I wanted to check it this applies the sub-expressions that can be determined as never evaluated because they are in non-evaluated operands.

Code:
int f(int a) {
    volatile int i;
    return ++a + sizeof(i);
}
 
Accessing the volatile variable i is a persistent side effect, but since this access happens as part of a sizeof operand, that is not evaluated, no actual access to the volatile actually happens.

Would it make sense to update this rule (and several other that use similar wording) to separate the undecidable case of infeasible paths from the very decidable case of non-evaluated expressions?

FYI, in similar cases, MISRA C++ uses wording such as " even if they occur in an infeasible path" instead of "even if specified as not being evaluated".
Reply


Messages In This Thread
13.3 What not being evaluated means? - by Loïc - 28-08-2026, 04:19 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)