TypeInfo in the library

Kenji Hara k.hara.pg at gmail.com
Mon Feb 17 08:01:18 PST 2014


2014-02-18 0:48 GMT+09:00 Dicebot <public at dicebot.lv>:

> On Monday, 17 February 2014 at 14:51:20 UTC, Kenji Hara wrote:
>
>> If a function is only used for CTFE, compiler can elide its codegen. It's
>> in the scope of optimization.
>>
>
> It can't know for sure it without some sort of WPO / LTO - and those won't
> happen any time soon. I propose a simple workaround that can be done right
> now (it can be optional compiler-specific addition)
>

In some case it would be possible without WPO/LTO:

- Immediately called lambdas

  enum x = (){ return some_sort_ctfe_calculartions; };   // lambda codegen
is unnecessary.

- modue private functions

  module a;
  private string foo() { ... }
  enum x = foo();
  // Compiler can elide codegen for 'foo', if other declarations
  // in module a don't use it for runtime code.

Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140218/372b6a09/attachment-0001.html>


More information about the Digitalmars-d mailing list