static if enhancement

Dominikus Dittes Scherkl via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 24 10:13:51 PDT 2016


On Friday, 24 June 2016 at 17:03:55 UTC, JohnnyC wrote:
> On Friday, 24 June 2016 at 15:29:18 UTC, Steven Schveighoffer 
> wrote:
>> On 6/24/16 11:24 AM, Andrei Alexandrescu wrote:
>>> Does anyone else find this annoying?
>>> https://issues.dlang.org/show_bug.cgi?id=16201 -- Andrei
>>
>> Maybe. That bug report does not identify any problems. What 
>> happens that's currently bad?
>>
>> -Steve
>
> Second that, can't see anything bad there!

The problem (that I see) is, that if you don't create the "else" 
path but the "static if" condition is true, you generate dead 
code behind the return statement (if the compiler doesn't 
optimize that away).
In our company that would be a no-go. So you always have to 
explicitly write (and indent) the else path.


More information about the Digitalmars-d mailing list