<blockquote>
<p>The nice thing about the <code>noexcept</code> is it can catch exceptions from the <code>catch</code> clause too, so it would be good if it could be used. </p>
</blockquote>
<p>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:</p>
<div class="highlight highlight-source-c++"><pre><span class="pl-k">extern</span> <span class="pl-s"><span class="pl-pds">"</span>C<span class="pl-pds">"</span></span> G_MODULE_EXPORT <span class="pl-k">void</span> <span class="pl-en">geany_load_module</span> (GeanyPlugin *plugin)
{
<span class="pl-k">try</span> {
plugin->info->name = <span class="pl-s"><span class="pl-pds">"</span>great plugin<span class="pl-pds">"</span></span>;
plugin->info->description = <span class="pl-s"><span class="pl-pds">"</span>saves the world<span class="pl-pds">"</span></span>;
plugin->info->version = <span class="pl-s"><span class="pl-pds">"</span>42<span class="pl-pds">"</span></span>;
plugin->info->author = <span class="pl-s"><span class="pl-pds">"</span>Me<span class="pl-pds">"</span></span>;
plugin->funcs->init = great_plugin_init;
plugin->funcs->cleanup = great_plugin_cleanup;
<span class="pl-c1">GEANY_PLUGIN_REGISTER</span> (plugin, <span class="pl-c1">225</span>);
} <span class="pl-k">catch</span>(...) {
<span class="pl-c">// not much to be done, and mustn't throw exceptions</span>
<span class="pl-c1">g_critical</span>(<span class="pl-s"><span class="pl-pds">"</span>My great plugin failed to register itself. Maybe it's not so great after all...<span class="pl-pds">"</span></span>);
}
}</pre></div>
<blockquote>
<p>I wouldn't think it would change the ABI […]</p>
</blockquote>
<p>It <em>has</em> 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.</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/issues/1215#issuecomment-244967214">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJ-mf6qDqiJFSwPUGfs7V66oUYVpvks5qnXgjgaJpZM4J1bF3">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ6PH1b9s6-PptrZ_7AP2KO8QtHkPks5qnXgjgaJpZM4J1bF3.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/geany/geany/issues/1215#issuecomment-244967214"></link>
<meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/geany/geany","title":"geany/geany","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/geany/geany"}},"updates":{"snippets":[{"icon":"PERSON","message":"@b4n in #1215: \u003e 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. \r\n\r\nYeah, 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:\r\n```C++\r\nextern \"C\" G_MODULE_EXPORT void geany_load_module (GeanyPlugin *plugin)\r\n{\r\n try {\r\n plugin-\u003einfo-\u003ename = \"great plugin\";\r\n plugin-\u003einfo-\u003edescription = \"saves the world\";\r\n plugin-\u003einfo-\u003eversion = \"42\";\r\n plugin-\u003einfo-\u003eauthor = \"Me\";\r\n \r\n plugin-\u003efuncs-\u003einit = great_plugin_init;\r\n plugin-\u003efuncs-\u003ecleanup = great_plugin_cleanup;\r\n \r\n GEANY_PLUGIN_REGISTER (plugin, 225);\r\n } catch(...) {\r\n // not much to be done, and mustn't throw exceptions\r\n g_critical(\"My great plugin failed to register itself. Maybe it's not so great after all...\");\r\n }\r\n}\r\n```\r\n\r\n\u003e I wouldn't think it would change the ABI […]\r\n\r\nIt *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."}],"action":{"name":"View Issue","url":"https://github.com/geany/geany/issues/1215#issuecomment-244967214"}}}</script>