Mail Archives: djgpp/2006/03/29/07:46:16
Martin Steuer <martin AT x DOT invalid> wrote:
> And if not, why? Would the optimizer have to assume that the first call
> to clock has changed the internal state of that function?
Generally it would --- but not if the two calles are initializers of
variables.
> And in general: how can one guarantee a certain order of execution for
> code like that from the OP?
By making them statements, rather than series of variable definitions.
That changes introduces what the C standard calls "sequence points",
which the optimizer must respect, and thus maintains order of things.
This would appear to be a side effect of the C99 feature allowing
variable definitions to occur in the middle of a block, rather than at
the start of it only.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -