News for hackers. Stuff that matters.
Re:Let's learn D game programming development (2021) [video] by generichuman on Wednesday June 15, 2022 @05:58AM (#31750962)
> unwinding style exceptions are basically zero cost with a modern compiler - the debt is paid in the implementation being tricky.

D doesn't return values when an exception is thrown as far as I know. How are exceptions' costs are paid by tricky implementation?

I thought exceptions require allocation and run-time type info and therefore always introduce some cost (this goes for D and C++). I guess returning values and allocating error strings statically can help with that (or maybe allocate some exception buffer on program start -- but that's technically "overhead"). Am I wrong, or missing some important context related to exceptions?

Re:Let's learn D game programming development (2021) [video] by mhh__ on Wednesday June 15, 2022 @06:11AM (#31751031)
If you don't throw there's no overhead, hence Exception-al cases only. The Optional style always has an overhead but the cost of actually throwing is much less.

Lots of people do statically allocate their errors now.

Implementing stack unwinding properly is not trivial.