Top 5

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Oct 11 07:54:43 PDT 2008


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



More information about the Digitalmars-d mailing list