K
Kenneth Brody
Kenny said:[snips]
main()
{
int i = 3;
i = i++;
printf("%d\n", i);
}Undefined behaviour is not /required/ to be bizarre behaviour.
Incidentally, I ran the program at home and got the output: "a
suffusion of yellow".
No you didn't. You got 3 or 4.
Really? Could you please quote the part of the standard that requires the
code above to produce a result of either 3 or 4?
Really? Could you please quote the biblical verse that requires the
price of tea in China to be between $30 and $50 a ton?
Or:
How do you spell non-sequitor?
I see no non-sequitur here.
[Hoping I am reading the attributions correctly.]
Richard said "No you didn't. You got 3 or 4." in reply to the
[unattributed] statement that the other poster had gotten "a
suffusion of yellow" as the output. The definitiveness of
Richard's post must be based on something. The only source of
such definitiveness in this group is "The Standard". If he is
so absolutely sure that a C compiler _must_ have give one of
those two results, it must be because The Standard says it must.
So, a request for C&V is quite reasonable, IMHO.
Lacking such a reference, I take Richard's statement as a matter
of opinion, along the lines of "I believe that the odds are that
most compilers will probably cause the program to output '3' or
'4'". (And I happen the agree that "most" compilers "probably"
will do that. I do not believe that "all" "will".)
--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>