Török Edwin <edwinto...@gmail.com> writes:

> But isn't this 'f(g(), x)' issue the same as the classic example
> of undefined behaviour with f(++i, ++i)?

It's not quite the same, because a function call (g())
introduces a sequence point.  In the f(++i, ++i) case,
I think there's only a sequence point after the call
to f.

I personally think the effect of f(x, g()) is unspecified
if g() changes the value of x.  I don't think the compiler
is required to chase down dependencies like this, that's why
the order of parameter passing is left unspecified.

I've often worried about exactly this case when writing
OCaml/C interfaces.

I'm far from an expert, however.

(One great thing about the ML family is that there
are exceptionally clear answers to questions like this.
Especially for Standard ML.)

Jeffrey


-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to