'goto" gone from computer languages or is it!
der Mouse
mouse at Rodents.Montreal.QC.CA
Fri May 13 19:01:07 CDT 2005
>> a[++i] = ++i;
> I assume that the above statement could have two possible
> interpretations:
> (a) j = ++i; k = ++i; a[j] = k;
> (b) j = ++i; k = ++i; a[k] = j;
True; those are two of the many possibilities.
> (i) Are there any other interpretations?
Yes.
> If so, what is the equivalent code?
There may not be any. When code wanders into realms specified to
produce undefined behaviour (as here, where i is modified twice without
an intervening sequence point), there is nothing compelling the
compiler to produce output that corresponds to any well-formed C code
at all. (I'm not even sure there's anything in the C spec calling for
the compiler to produce *any* output in such circumstances.)
If you want possible interpretations that *do* correspond to writable C
code, here's one for you:
a[i*i]=314156; i=a[0]/a[-1];
(Of course, a real compiler would be unlikely to do that....)
> (ii) Does gcc 3.3 produce a warning or an error message?
I don't know (and mostly don't care).
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse at rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
More information about the cctalk
mailing list