Wincent Colaiuta schrieb:
El 13/3/2008, a las 0:39, Junio C Hamano escribió:
quoted
if (strcmp(value, "now")) {
unsigned long now = approxidate("now");
if (approxidate(value) >= now)
return error("Invalid %s: '%s'", var, value);
...
}
Are you sure that that alternative provides any guarantees about
evaluation order either? (I'm not a compiler expert, nor am I consulting
a copy of the standard; but I don't think it does.)
There is a sequence point at the semicolon. This means that all observable
side effects of approxidate("now") are visible when approxidate(value) is
evaluated (and no observable side effect of the latter is visible when the
former is evaluated), which doesn't leave much choice for the compiler.
So, yes, this does guarantee the intended evaluation order.
-- Hannes