Templates vs CTFE

Max Samukha spambox at d-coding.com
Fri Jan 7 05:59:01 PST 2011


On 01/07/2011 03:12 PM, Don wrote:
> Max Samukha wrote:
>> On 01/06/2011 09:28 PM, Robert Clipsham wrote:
>>>
>>> Put each of those implementations in its own file, then call it several
>>> times. Look at the binary size for each implementation, also run
>>> `strings ctfeTest` if you're on a *nix. This should give you your
>>> answer :)
>>>
>>
>> The problem is they are not easy to compare using artificial tests.
>> For example, there is a hard-wired limit to template nesting depth in
>> the compiler. And with the number of input elements less than this
>> limit, the difference in results seems to be insignificant.
>>
>> BTW, if we want to be taken seriously such limits should be
>> configurable. Why the depth of 500 and not 600? I wonder where the
>> value comes from.
>
> It's about the largest value it can be before a compiler stack overflow
> occurs.

I meant the value should not be a magical number hard-coded somewhere in 
template.c. One can configure stack size and it should be possible to 
configure a dmd build with adjusted nesting value.


More information about the Digitalmars-d mailing list