are mixin string templates with functions removed?

Ali Çehreli acehreli at yahoo.com
Thu Aug 1 10:53:38 PDT 2013


On 08/01/2013 10:45 AM, H. S. Teoh wrote:
> On Thu, Aug 01, 2013 at 07:12:51PM +0200, John Colvin wrote:
>> On Thursday, 1 August 2013 at 17:09:07 UTC, JS wrote:
>>> If I have a bunch of templates that are only used for code
>>> generation, are they removed in the binary(since they are not
>>> needed)?
>>
>> templates don't exist in binaries.
>
> Templates are like cookie molds, you use them to generate lots of
> (almost) identical cookies, but you never serve the mold to the
> customer. ;-)
>
>
> T
>

I think the question is whether the instantiations of such templates are 
removed. If the instance is used only to initialize an enum, the 
function shouldn't stay in the binary.

Even if the function remains, I think the linker takes care of removing 
unused functions.

Ali



More information about the Digitalmars-d-learn mailing list