Dear all,
I would like to open another topic to try to clarify a doubt raised on
my previous post today with the subject 'printf("%d%d%d ")'.
Reading through the standard, I cannot find a clear definition of what
is a constraint violation.
Repeating the citation:
3.8
1 constraint
restriction, either syntactic or semantic, by which the exposition
of language elements is to be interpreted
As I understand it, a constraint is any explicit syntax or semantic rule.
Still, i = i++; is not a constraint violation.
Why? The standard clearly says that a variable cannot be modified more
than once within a single sequence point. The aforementioned code
modifies i twice. Isn't it a semantical rule being violated?
P.S. It's incredible how many things I get wrong reading the standard....
--
Pietro Cerutti
I would like to open another topic to try to clarify a doubt raised on
my previous post today with the subject 'printf("%d%d%d ")'.
Reading through the standard, I cannot find a clear definition of what
is a constraint violation.
Repeating the citation:
3.8
1 constraint
restriction, either syntactic or semantic, by which the exposition
of language elements is to be interpreted
As I understand it, a constraint is any explicit syntax or semantic rule.
Still, i = i++; is not a constraint violation.
Why? The standard clearly says that a variable cannot be modified more
than once within a single sequence point. The aforementioned code
modifies i twice. Isn't it a semantical rule being violated?
P.S. It's incredible how many things I get wrong reading the standard....
--
Pietro Cerutti
Comment