lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Oct 21, 2015 at 6:46 PM, Philipp Janda <siffiejoe@gmx.net> wrote:
 
"Real C" for the scope of this thread is defined (by me) as code compiled by a C compiler in contrast to an `extern "C"` function that is compiled by a C++ compiler. E.g. gcc by default does "The Right Thing" (`-fexceptions`) for C++ code, but not for C code. That's why I made the distinction. In theory it isn't needed, because the behavior is undefined by the C++ and C standards in both cases.

That is again not true. "Undefined behaviour" has a very specific meaning in the current C++ standard (clause 1.3.24) and the passage quoted earlier does not use that term. Your definition of "Real C" misses the point, because this area, as stated earlier, is implementation specific. It is sufficient for me that my implementation specifies a behaviour that is suitable for my use. Whatever behaviour observed with your implementation is immaterial to me.

`lua_pcall()` (C++) -> Lua code -> `lua_CFunction` (`extern "C"`) -> `lua_error()` (C++) -> `throw`.
So we have undefined behavior

No, as explained above.
 
Whether it works in practice depends on compiler/implementation, command line flags, whether it's "real C" code the exception is passing through, etc.

Correct.

Cheers,
V.