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

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Jun 28 16:30:05 UTC 2021


On Monday, 28 June 2021 at 14:01:50 UTC, Steven Schveighoffer 
wrote:
> This would be like saying null pointer dereferences only 
> trigger a segfault in safe code, so now all system code that 
> doesn't want to corrupt some mmapped data at the null page must 
> first check that a pointer is not null before using. It's 
> nonsense.

Trapping page 0 is not foolproof. For instance if you have a 
pointer to a static array, you could easily be outside the range 
that will trap. Not all hardware can trap page 0 either. So you 
do end up with a solution that works often, but not always. But 
for stacks specifically, there is nothing that prevents you from 
having multiple guard pages.

Just make it user configurable: min stack depth, max stack depth, 
number of guard pages.






More information about the Digitalmars-d mailing list