News for hackers. Stuff that matters.
Re:Three new utility functions in C++23 by actionfromafar on Wednesday November 09, 2022 @07:59AM (#33530924)
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.)

Re:Three new utility functions in C++23 by dahfizz on Wednesday November 09, 2022 @09:12AM (#33531829)
In a real codebase, this would be wrapped by a macro to abort in a debug build but gain the optimizations in a release build.
Re:Three new utility functions in C++23 by eco on Wednesday November 09, 2022 @11:29AM (#33533955)
cppreference suggests this as an implementation for std::unreachable but as near as I can tell neither clang nor MSVC does that (yet?).
Re:Three new utility functions in C++23 by leni536 on Wednesday November 09, 2022 @03:51PM (#33537656)
I would have expected the _LIBCXX_ASSERTIONS macro in libc++ to affect the behavior, similarly to many other standard library undefined behaviors.
Re:Three new utility functions in C++23 by actionfromafar on Wednesday November 09, 2022 @11:48AM (#33534252)
Can'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.