Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
13.3 Should side effects be allowed in comma expressions?
#1
In a comma expression (which is discouraged by another advisory rule, 12.3, but could still be used), there is a clear separation in term of execution between what comes before and what comes after the comma. Therefore, I think the rationale is not very strong in this case.

What would you think of relaxing 13.3 and making this example compliant (it would still be non-compliant with 12.3):

Code:
int f(int n, int*dest) {
    for (int i = 0 ; i<10 ; ++i, ++dest) { // Currently non-compliant
        *dest = i*i;
    }
}
Reply


Messages In This Thread
13.3 Should side effects be allowed in comma expressions? - by Loïc - 31-08-2026, 12:52 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)