Schrodinger's CTFE

Steven Schveighoffer schveiguy at gmail.com
Fri Jul 17 02:15:04 UTC 2020


On 7/16/20 6:12 PM, Paul Backus wrote:
> On Wednesday, 15 July 2020 at 20:33:23 UTC, Steven Schveighoffer wrote:
>> I found a weird workaround to the "Unreachable code" problem.
>>
> [...]
>>
>> int foo(bool x)()
>> {
>>    if(x && (__ctfe || !__ctfe)) return 1;
>>    return 2;
>> }
>>
>> I think this is a way to fix some of those static foreach loops with 
>> returns which can have these reachability problems. Only, it's really 
>> verbose and ugly. Maybe we still should have that other variable?
>>
> 
> Am I the only one who thinks that this is completely insane?

It's not just you.

> 
> Maybe if the unreachable code warning is causing us this much trouble, 
> we should just get rid of it. Personally, the number of times it's done 
> anything helpful for me are far outweighed by the number of times it's 
> gotten in my way.

I would be fine if the compiler just didn't generate unreachable code, 
and didn't tell me about it.

-Steve


More information about the Digitalmars-d mailing list