4 ms·
LuaJIT is another modern low-level language. It has some remarkable undefined behavior like the evaluation order for function arguments. Scares me a bit. https
by lukego 9y ago
LuaJIT is another modern low-level language. It has some remarkable undefined behavior like the evaluation order for function arguments. Scares me a bit.
https://github.com/LuaJIT/LuaJIT/issues/238 https://github.com/LuaJIT/LuaJIT/issues/238
- chii 9y agolua is no way a "low level" language
- readittwice 9y agoThe same is true in C/C++: Function argument evaluation order is unspecified. BUT: that doesn't mean this is undefined behavior, it is just unspecified. unspecified != undefined behavior See this Stack overflow answer for an explanation: https://stackoverflow.com/questions/2397984/undefined-unspecified-and-implementation-defined-behavior https://stackoverflow.com/questions/2397984/undefined-unspec...
- rbehrends 9y agoThis would not be what is called undefined behavior per the C standard, but unspecified or implementation-defined behavior. The bad thing about "undefined behavior" is that the implementation is basically allowed to do whatever it wants, while unspecified and implementation-defined behavior still has sane semantics. Unspecified behavior allows the language implementation to choose any one from several possible implementations, implementation-defined behavior requires the language implementation to define the semantics itself.
- eru 9y agoAre you sure that undefined, instead of merely unspecified? Ie function arguments are still evaluated in some (possibly changing) order. C++ undefined behavior allows to eg format your hard disk or launch the nukes.