[Github-comments] [geany/geany] Plugins: Needless forward declaration of geany_load_module() (#1215)

elextr notifications at xxxxx
Tue Sep 6 13:28:55 UTC 2016


> That's not the case here, as this is only directly called by Geany, right?

I was thinking a proxy written in C++ could cause Geany to call it on a subplugin? (but I don't know the details of proxy and geany interaction).

> BTW, can really C-linkage stuff throw exceptions? Sure it's somewhat unrelated, but if it's meant to be called by C code it better not throw indeed.

As best I can tell its UB.  The `extern "C"` is defined to control calling convention and name mangling, nothing else. I would doubt the C++ compiler will unilaterally apply `noexcept` to `extern "c"` functions since its still ok to call them from C++ as well.  

In fact a disaster may occur without even the need to go through C and back to C++.  If the stack unwinding moves from C++ to C stack frames, will it see frames without handlers, or will it see some random part of the C frame as specifying an exception handler and do "interesting" things?  UB.

Its just very important to prevent all exceptions from exiting C++ into C, one of the rare places where swallowing exceptions is probably acceptable.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/1215#issuecomment-244949764
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20160906/c15ba194/attachment.html>


More information about the Github-comments mailing list