__ctfe
Don Clugston
dac at nospam.com
Tue Oct 2 00:45:10 PDT 2012
On 01/10/12 21:30, Adam D. Ruppe wrote:
> On Monday, 1 October 2012 at 19:22:37 UTC, Philippe Sigaud wrote:
>> Something I wanted to ask for a long time: is there any runtime speed
>> penalty in using __ctfe?
>
> No. What happens is when it goes to the compile the runtime code, __ctfe
> is a constant false, so then the optimizer can see it is obviously dead
> code and eliminate the branch entirely. You don't even have to use the
> -O switch to get this:
Yes, I was VERY careful about this. The "if (__ctfe)" branch gets
discarded at the end of the front-end. The backend never sees it.
More information about the Digitalmars-d
mailing list