co**************@gmail.com said:
On Oct 11, 12:02 pm, Richard Heathfield <r...@see.sig.invalidwrote:
>coolguyaround...@gmail.com said:
See the following code snippet:
{
int a=1;
printf("%d %d %d",a,++a,a++);
}
Will the behavior be undefined/unspecifed or no such thing?
Undefined.
Please state reasons, along with your post(s).
Same reason it was undefined the other eight million times it was asked.
Why do you say undefined and not unspecified?
Same reason it was undefined the other eight million times it was asked.
Quoth the Standard: "Between the previous and next sequence point an
object shall have its stored value modified at most once by the evaluation
of an expression. Furthermore, the prior value shall be accessed only to
determine the value to be stored."
Note the uses of the word "shall". And these are "shall"s that are not part
of a constraint.
"In this Standard, ``shall'' is to be interpreted as a requirement
on an implementation or on a program; conversely, ``shall not'' is to
be interpreted as a prohibition."
"If a ``shall'' or ``shall not'' requirement that appears outside of a
constraint is violated, the behavior is undefined."
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999