4 ms·
Yes, but what was unreachable may get reachable as I do changes to the program. I see the utility when doing highly optimized library code. But for my purposes
by actionfromafar 4y ago
Yes, but what was unreachable may get reachable as I do changes to the program. I see the utility when doing highly optimized library code.
But for my purposes I much prefer to stick something which flags me (exception or logging or whatever) of "this should never happen" instead of crashing. (Undefined.)
- dahfizz 4y agoIn a real codebase, this would be wrapped by a macro to abort in a debug build but gain the optimizations in a release build.
- eco 4y agocppreference suggests this as an implementation for std::unreachable but as near as I can tell neither clang nor MSVC does that (yet?).
- leni536 4y agoI would have expected the _LIBCXX_ASSERTIONS macro in libc++ to affect the behavior, similarly to many other standard library undefined behaviors.
- actionfromafar 4y agoCan't help but feel offended that my codebase isn't real. Thanks for the laugh though :-D I'd rather have solid logging and/or abort handling than some extra yak hairs shaved off the speed on my release builds. I'm weird that way.