<div dir="ltr">SEH is not C or C++, it's a Microsoft thing with no standards to speak of. It seems irrelevant to this conversation to me.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 20 Aug 2024 at 10:36, Richard (Rikki) Andrew Cattermole via Digitalmars-d <<a href="mailto:digitalmars-d@puremagic.com">digitalmars-d@puremagic.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On 20/08/2024 12:24 PM, Gregor Mückl wrote:<br>
> On Sunday, 18 August 2024 at 09:42:16 UTC, Nicholas Wilson wrote:<br>
>> On Sunday, 18 August 2024 at 04:43:34 UTC, Manu wrote:<br>
>>> I just tried using ImportC for the first time ever, but I was surprised<br>
>>> when I immediately received a sea of errors calling the C symbols from<br>
>>> `nothrow @nogc` functions.<br>
>>> My entire program is `nothrow @nogc`... I assumed ImportC would be<br>
>>> supremely suitable in this context, but apparently not...<br>
>>><br>
>>> Is there something I've missed? Is there a plan for this?<br>
>>> I found just one single very short forum thread...<br>
>>><br>
>>> This is classic D experience; so much work has been done on this, and <br>
>>> then the moment I try and use something I encounter a showstopping <br>
>>> oversight >_<<br>
>><br>
>> Well, C may call C++ which may throw. It is very unlikely to call the <br>
>> GC however.<br>
>><br>
>> I don't think it would be hard to add a switch that "`extern(C)` <br>
>> functions being called from import C are `@nogc`".<br>
> <br>
> Here's what I'm thinking:<br>
> <br>
> The C function interface has no notion of C++ exceptions (AFAIK it's <br>
> following C specs, not C++), so C++ exceptions should not even be a <br>
> consideration at that point. I do not think that throwing a C++ <br>
> exception up a stack that contains extern(C) functions is even properly <br>
> defined behavior on the C++ side. In other words, all ImportC <br>
> declarations should be implicitly @nothrow.<br>
<br>
Its defined for MSVC:<br>
<br>
<a href="https://learn.microsoft.com/en-us/cpp/cpp/structured-exception-handling-c-cpp?view=msvc-170" rel="noreferrer" target="_blank">https://learn.microsoft.com/en-us/cpp/cpp/structured-exception-handling-c-cpp?view=msvc-170</a><br>
<br>
"Structured exception handling (SEH) is a Microsoft extension to C and <br>
C++ to handle certain exceptional code situations, such as hardware <br>
faults, gracefully."<br>
<br>
I'm pretty sure for other platforms it is also defined as part of <br>
unwinding, although I can't be bothered to hunt for the specification. <br>
It's not about C, it's about languages that are not C++ (consider JIT's <br>
for instance).<br>
</blockquote></div>