More on C++ stack arrays

Wyatt wyatt.epp at gmail.com
Mon Oct 21 09:25:20 PDT 2013


On Monday, 21 October 2013 at 15:26:33 UTC, Denis Shelomovskij 
wrote:
>
> So I'd prefer to change default stack allocation size if needed 
> and not confuse user with manual choice.

Wouldn't it work to make it optional then?  Something like this, 
I think:
auto tempCString(To = char, From, Length = 1024)(in From[] str) 
if (isSomeChar!To && isSomeChar!From);

Choosing a sane default but allowing specialist users an easy way 
to fine-tune it for their needs while keeping the basic usage 
simple is something I'd advocate for.  (Personally, I think 1K 
sounds quite high; I'd probably make it 256 (one less than the 
max length of filenames on a whole bunch of filesystems)).

-Wyatt


More information about the Digitalmars-d mailing list