Template limits

Walter Bright newshound1 at digitalmars.com
Mon May 25 10:31:59 PDT 2009


bearophile wrote:
>> It's a bug in D1, actually.  The bug was fixed in D2 but not yet in
>> D1. As you increase the value, D1 will just silently segfault
>> eventually. I believe D1 will be fixed in the next release.<
> 
> So I'll be unable to loop a template 1000 times in D1 too?


The problem is that enough recursion will blow up the stack in the 
compiler. I set a limit below that. But, naturally, for any limit I set 
someone will try to exceed it.

The solution is to use an iterative algorithm with CTFE, not recursive 
template expansion.



More information about the Digitalmars-d mailing list