Thread overview
betterC and exceptions
Nov 12, 2021
Imperatorn
Nov 13, 2021
Elronnd
Nov 13, 2021
Paulo Pinto
Nov 12, 2021
russhy
November 12, 2021

What does it take to get some kind of exceptions in betterC?

I would think that it would be sufficient to either limit the size of an exception and provide a fixed size buffer in thread-local-storage (256 bytes).

Yes, that means giving up throwing "strings" and retaining old exceptions, but I think that is acceptable for system level programming.

November 12, 2021

On Friday, 12 November 2021 at 08:44:08 UTC, Ola Fosheim Grøstad wrote:

>

What does it take to get some kind of exceptions in betterC?

I would think that it would be sufficient to either limit the size of an exception and provide a fixed size buffer in thread-local-storage (256 bytes).

Yes, that means giving up throwing "strings" and retaining old exceptions, but I think that is acceptable for system level programming.

I think LWDR also tries to solve this.
Maybe a similar approach could be used.

November 12, 2021

On Friday, 12 November 2021 at 09:04:48 UTC, Imperatorn wrote:

>

I think LWDR also tries to solve this.
Maybe a similar approach could be used.

This? https://github.com/hmmdyl/LWDR

Hm, looks like they add a lot of stuff, but some of it seems to be opt-in.

Their plan says they have a working implementation for GDC, but not LDC:

https://github.com/hmmdyl/SAoC2021/blob/main/plan.md

Ok, let's see what they come up with. The ideal would be to reuse whatever C++ does.

November 12, 2021

On Friday, 12 November 2021 at 09:04:48 UTC, Imperatorn wrote:

>

I think LWDR also tries to solve this.
Maybe a similar approach could be used.

This? https://github.com/hmmdyl/LWDR

Hm, looks like they add a lot of stuff, but some of it seems to be opt-in.

Their plan says they have a working implementation for GDC, but not LDC:

https://github.com/hmmdyl/SAoC2021/blob/main/plan.md

Ok, let's see what they come up with. The ideal would be to reuse whatever C++ does.

November 12, 2021

betterC doesn't need exception

why do you want that? use error codes

if that's not enough, let's think about something better than exception

November 12, 2021

On Friday, 12 November 2021 at 21:25:06 UTC, russhy wrote:

>

betterC doesn't need exception

why do you want that? use error codes

if that's not enough, let's think about something better than exception

You mean error codes with throw/catch syntax?

November 13, 2021
On Friday, 12 November 2021 at 09:13:22 UTC, Ola Fosheim Grøstad wrote:
> Ok, let's see what they come up with. The ideal would be to reuse whatever C++ does.

I believe C++ uses reference counting.
November 13, 2021
On Saturday, 13 November 2021 at 01:06:00 UTC, Elronnd wrote:
> On Friday, 12 November 2021 at 09:13:22 UTC, Ola Fosheim Grøstad wrote:
>> Ok, let's see what they come up with. The ideal would be to reuse whatever C++ does.
>
> I believe C++ uses reference counting.

Each compiler does its own way, and on Visual C++'s case it takes advantage that Windows supports exceptions at the OS level.