3 ms·
The difference is that in C++ it's expected that you'll overload operators, provide implicit conversions and throw exceptions. Of course you can write terrible
by quietbritishjim 2y ago
The difference is that in C++ it's expected that you'll overload operators, provide implicit conversions and throw exceptions. Of course you can write terrible code in C but it is not common accepted practice to hide a longjmp in a macro disguised as an identifier.
- gpderetta 2y agopthread_cleanup_{push,pop}
- jay-barronville 2y agoThe funny thing is, examples of macro craziness only strengthen my point, because C++ inherits all of that in addition to its hidden behaviors and magical semantics. It’s rare to find serious C code doing a lot of crazy things behind macros. In my experience, the few exceptions I can think of include the GMP library and data structure-related code trying to emulate generics (mostly hash tables).
- gpderetta 2y agoYes, C++ is a larger language for sure. But because it has better abstraction facilities, macro hackery is less common.
- pjmlp 2y agoIndeed, you hide longjump in a #define macro instead, with a do while block trick.