Top 5

Christopher Wright dhasenan at gmail.com
Sat Oct 11 21:05:50 PDT 2008


Andrei Alexandrescu wrote:
> Christopher Wright wrote:
>> Andrei Alexandrescu wrote:
>>> Steven Schveighoffer wrote:
>>>> "Andrei Alexandrescu" wrote
>>>>>> typeof(d) == char[15]*
>>>>> just char[15].
>>>>
>>>> What is the point of that?  Why wouldn't you just say:
>>>>
>>>> char[15] d;
>>>
>>> Only uniformity. In general Type() creates an instance of Type. Easy!
>>>
>>>>> S * pS = allocate!(S)(... optional args ...);
>>>>
>>>> Ugh.  How many extra 'wrapper' functions are built into the code 
>>>> because of this?  I suppose it probably would be inlined.
>>>
>>> Performance is not to worry about. allocate does only a call to 
>>> gc.allocate, the requisite initialization, and a cast. The cost of 
>>> call to gc.allocate dwarfs the call overhead even in absence of 
>>> inlining.
>>
>> Compile times are something to worry about. I'm quite hesitant to use 
>> templates when there is a reasonable alternative; they tend to 
>> increase compilation times dramatically, even if they're relatively 
>> simple.
> 
> I think this is a self-sustaining myth. I use many templates but rarely 
> notice a compilation time issue.
> 
> Andrei

I've noticed a huge difference. However, that was with a largish 
recursive set of templates.



More information about the Digitalmars-d mailing list