Does 'D' language supports 'C' like VLA?

via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 14 00:44:23 PDT 2015


On Tuesday, 14 April 2015 at 07:34:28 UTC, Ola Fosheim Grøstad 
wrote:
> VLAs can save stackspace compared to fixed max sized arrays, 
> but add recursion and try to figure out the right threshold 
> between small and large? You can't? So you need whole program 
> analysis...

To be clear: you get many of the same problems with fixed sized 
arrays (but not all) if you cannot prevent recursion.

Maybe the better option is to have a pragmas for "max stack frame 
size in bytes" and "max size for this VLA". Then you can estimate 
the stack use by worst case recursive depth and let the backend 
choose where to allocate if the max size for the VLA can exceed 
the headroom left in a max-sized stack frame.



More information about the Digitalmars-d mailing list