Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think the PAPCFUNC type needs to have noexcept. Wrapping a function typedef in extern "C" does not make it imply noexcept IIRC.

It would also help if the APC docs documented that APCs must not throw.



It is a C interface. It is implicitly noexcept. I filed bugs against both GCC and LLVM requesting warnings when someone passes a non-noexcept C++ function pointer to either a C function or to a C++ noexcept function:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118263

https://github.com/llvm/llvm-project/issues/121427

Perhaps the C++ standards committee should specify that doing this should cause a compiler failure, rather than a warning.


Thanks for checking, clarifying, and filing those bugs!


This would actually be a nice change (but probably very breaking) for c interfaces called from a c++ context to be implicitly noexcept.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: