6 ms·
You know what's even better? When someone who writes that style of code (in C++, no less!) knows that one of the intermediate values could be null, so they use
by rcoder 17y ago
You know what's even better? When someone who writes that style of code (in C++, no less!) knows that one of the intermediate values could be null, so they use a set of macros involving setjmp and longjmp, and trap SIGFPE, all to implement a fragile sort of try/catch for null de-references.
Clever? Insane? Horribly un-portable and prone to breakage depending on compiler, libc, and OS versions? All of the above!
(And yes, I have seen this coding style used in multiple projects at a major corporation. It was a favorite of a coder-turned manager, which means it tended to sneak in on any project he supervised.)
- jrockway 17y agoClever? Insane? Horribly un-portable and prone to breakage depending on compiler, libc, and OS versions? All of the above! Yeah, you already said it was C++.