July 16, 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
July 17, 2020
On Thursday, 16 July 2020 at 22:15:05 UTC, Paul Backus wrote:
>
> 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'm taking a look into trying to get rid of "false positive" warnings.  I think considering whether a return statement comes from a static if when doing stuff in blockexit.d.  Would love to hear suggestions for this/other approaches.

My test case is basically:

static foreach(whatever){
  static if(something){
     return false;
  }
}
return true;

which currently warns whenever one of the early returns is triggered.
1 2
Next ›   Last »