CTFE attribute

Don Clugston dac at nospam.com
Mon Jan 30 00:47:41 PST 2012


On 28/01/12 19:39, Walter Bright wrote:
> On 1/28/2012 6:50 AM, Manu wrote:
>> I'd certainly like to be able to mark these functions CTFE to be sure
>> no runtime
>> code will ever be generated for them, and also, what can I do about CTFE
>> imports? I don't want that import in my binary...
>
> Being in your object file doesn't mean they make it into the binary.
> Optlink, for example, will remove unreferenced COMDATs.


The problem is how to prevent the moduleinfo from getting linked in. 
Though this is a general problem, not specific to CTFE.

One thing I have been considering is, if a template is only ever 
instantiated in CTFE (eg in a static if, or while defining an enum 
value), should it still get written into the obj file? I don't think it 
is ever necessary, and discarding it would save a lot of space and time.


More information about the Digitalmars-d mailing list