Stack frames larger than 4K should be rejected, but what if I want more

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Tue Jun 29 07:07:19 UTC 2021


On Tuesday, 29 June 2021 at 04:00:24 UTC, Vladimir Panteleev 
wrote:
> I recall that Pascal debug builds added manual checks for stack 
> overflow. This was especially necessary in real mode, where a 
> stack overflow would just crash the PC. I don't see why D 
> couldn't do the same. It would be useful in protected mode with 
> small variables too, as it would allow generating a normal D 
> exception instead of a segmentation fault.

You could, if all your code is written in D, but D has to adapt 
stack layout to what FFI code expects. For instance, if 30% of 
your code is FFI, then you only detect 70% of stack overflows.



More information about the Digitalmars-d mailing list