Schrodinger's CTFE

Paul Backus snarwin at gmail.com
Thu Jul 16 22:15:05 UTC 2020


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?
>
> -Steve

Is it just me, or does anyone else think that this is completely 
insane?

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.


More information about the Digitalmars-d mailing list