are mixin string templates with functions removed?

JS js.mdnq at gmail.com
Thu Aug 1 10:52:28 PDT 2013


On Thursday, 1 August 2013 at 17:47:00 UTC, 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

But what about the functions that exist in them?

e.g.,

template A()
{
     void A()
     {
         B();
     }
     void B() { }
}

is everything in the template removed 100% or is there junk that 
the compiler doesn't remove?


Oh... and I'm not talking about theoretical... I'm talking about 
what dmd actually does.


More information about the Digitalmars-d-learn mailing list