why is this flagged as poor style?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Sep 22 21:35:16 UTC 2020


The style checker for phobos flags this code:

static if (!is(typeof(unaryFun!fun(r.front)) == Flag!"each"))
     cast(void) unaryFun!fun(r.front);
else
     if (unaryFun!fun(r.front) == No.each) return No.each;

with "Mismatched static if. Use 'else static if' here."

But in fact the intention is to execute a run-time `if` on the `else` 
branch of the `static if`.

Is this worth fixing?



More information about the Digitalmars-d mailing list