Are there any "bad" side-effects to enabling SOL_CHECK_ARGUMENTS in luaengine.h aside from performance reasons?

Code
#define SOL_CHECK_ARGUMENTS
#include "sol2/sol.hpp"

I inevitably type . instead of : and get a segfault.

For example:

Code
print((manager:machine():debugger().consolelog:__len()))
2

but if I change the : to a ., then kaboom.

Code
print((manager:machine():debugger().consolelog.__len()))
Segmentation fault (core dumped)
and if I uncomment #define SOL_CHECK_ARGUMENTS
it will gracefully give me an error.

Code
print((manager:machine():debugger().consolelog.__len()))
error: 	[string "print((manager:machine():debugger().consolelo..."]:1: stack index 1, expected userdata, received no value


according to:

https://github.com/ThePhD/sol2/issues/408

Quote
ThePhD commented on May 19

Please turn on the safety features. This will crash your code with a specific error message. You can turn on the most important safety feature by definining SOL_CHECK_ARGUMENTS either VIA command line or by putting it before every single <sol.hpp> include.

The segfault is intentional at this level. If you do not turn on safety features we assume that you are doing so for performance reasons and do not want the (small, but sometimes important to people) overhead, or because you expect certain kinds of type punning to happen (e.g., like the many type-puns the MAME engine does in order to fiddle with bits and mess with other low-level things).

Last edited by Golden Child; 11/22/17 03:02 PM.