Does the C++ standard mandate that C-linkage functions are `noexcept`? -
i can't find in standard forces functions declared extern "c" noexcept, either implicitly or explicitly.
yet, should clear c calling conventions cannot back upwards exceptions... or it?
does standard mention this, somewhere i've missed? if not, why not? left implementation detail of sorts?
as far can tell there no guarantee function defined "c" linkage not throw exceptions. standard allows c++ programme both phone call external function "c" language linkage, , define functions written in c++ have "c" language linkage. hence there nil prevent c++ programme calling function "c" language linkage written in c++ (in compilation unit maybe, although not necessary). unusual thing do, hard rule out. don't see in standard says doing lead undefined behavior (in fact since standard cannot define bahavior of function not written in c++, only usage there not formally undefined behavior).
as consequence think error assume "c" linkage implies noexcept.
c++ c c++11 language-lawyer noexcept
No comments:
Post a Comment