Re:C++'s `Noexcept` Can (Sometimes) Help (Or Hurt) Performance
by tsimionescu on Tuesday August 06, 2024 @06:24AM
(#41169449)
Well, given that qsort and bsearch take a function pointer and call it, that function pointer can easily point to a function that throws. So I think this applies to all implementations of qsort and bsearch. Especially since there is no way to mark a function pointer as noexcept.
[ Parent
| on HN ]
Re:C++'s `Noexcept` Can (Sometimes) Help (Or Hurt) Performance
by leni536 on Tuesday August 06, 2024 @12:32PM
(#41172437)
> Especially since there is no way to mark a function pointer as noexcept.
There is, noexcept is part of the type since C++17. In fact, I prefer noexcept function pointer parameters for C library wrappers, as I don't expect most libraries written in C to deal with stack unwinding at all.
Re:C++'s `Noexcept` Can (Sometimes) Help (Or Hurt) Performance
by tsimionescu on Wednesday August 07, 2024 @06:00AM
(#41179793)
Oops, you're right, I hadn't checked that this had changed in C++ 17.