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

Colomban Wendling notifications at xxxxx
Tue Sep 6 14:26:43 UTC 2016


> The nice thing about the `noexcept` is it can catch exceptions from the `catch` clause too, so it would be good if it could be used.  

Yeah, but my point is that it's not really a solution, as it'll abort Geany altogether, not just the plugin.  So a well-behaved plugin should manage it anyway.  Maybe do:
```C++
extern "C" G_MODULE_EXPORT void geany_load_module (GeanyPlugin *plugin)
{
  try {
    plugin->info->name = "great plugin";
    plugin->info->description = "saves the world";
    plugin->info->version = "42";
    plugin->info->author = "Me";
  
    plugin->funcs->init = great_plugin_init;
    plugin->funcs->cleanup = great_plugin_cleanup;
    
    GEANY_PLUGIN_REGISTER (plugin, 225);
  } catch(...) {
    // not much to be done, and mustn't throw exceptions
    g_critical("My great plugin failed to register itself.  Maybe it's not so great after all...");
  }
}
```

> I wouldn't think it would change the ABI […]

It *has* not to change the ABI of the C decl, as the C caller won't know about it so won't do anything in either case.  It still has to be able to call the function just the same.

-- 
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-244967214
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20160906/e025df2d/attachment.html>


More information about the Github-comments mailing list