4 ms·
> In C it’s undefined because it depends on how arguments are passed on the current platform (consider yourself lucky if you don’t remember __pascal or __stdcal
by josalhor 6y ago
> In C it’s undefined because it depends on how arguments are passed on the current platform (consider yourself lucky if you don’t remember __pascal or __stdcall). In Rust it’s undefined because there’s no format specification to tell you even that much.
>> Regarding argument evaluation order, technically it is not yet documented https://github.com/rust-lang/reference/issues/248 https://github.com/rust-lang/reference/issues/248 but has been left-to-right for basically forever https://internals.rust-lang.org/t/rust-expression-order-of-e https://internals.rust-lang.org/t/rust-expression-order-of-e... and I actually thought that it was documented as such.
I am aware the word "undefined" references the order of evaluation. However, I just want to clear possible confusion on the matter. Code that depends on evaluation order doesn't produce undefined behaviour. It produces unspecified behaviour. (This is not a directly reply to Steve, who am I sure knows more about this than I ever will).
- comex 6y agoAnd there is no guarantee that the order your compiler decides on has anything to do with the calling convention.