'goto" gone from computer languages or is it!
vrs
vrs at msn.com
Fri May 13 14:11:51 CDT 2005
From: "Dave Dunfield" <dave04a at dunfield.com>
> So, although unlikely that the compiler would defer two operations and not
> another, it is potentially possible that the "results" could also be 0 0
1,
> 0 0 2, 0 1 1 etc. (in any order).
Agreed.
> Officially this type of code (that which modifies an Lvalue multiple times
> within the same sequence interval) invokes "undefined behaviour", which
> means that the compiler can do "anything" - although highly unlikely, the
> compiler can happily return 6 6 6 in this case, and leave the value of i
at
> 31415 (or anything else) ... and be performing in a perfectly legal sense
> - undefined operation is exactly that. The function performed is not
defined
> by the standard.
I think the functions to be performed are defined, and only their order is
undefined.
> On other words, it's not valid 'C' (although it is syntactically correct,
and
> most compilers will accept it without a diagnostic).
Which would make this an overstatement. I think it is perfectly valid C,
and the compiler has (after much deliberation) been allowed to generate the
most efficient code.
> I think the OP's point has been completely missed (that a valid program is
a
> inherently very definitive and detailed specification).
I thought the point was that, at the margins, the "valid program" is *not*
as detailed a specification as was claimed/expected. (Though I still don't
know of anything more detailed. In fact, I think most programs are
over-specifications of the desired behavior. That is, they require a lot of
specific behavior that is actually unimportant to the correct result.)
Vince
More information about the cctalk
mailing list