On Sunday, 7 May 2017 at 22:34:14 UTC, bastien penavayre wrote:
Why is the code following "return true" evaluated ?

It isn't evaluated, it is just compiled. The compile happens before it is run, so it doesn't really know if it is reachable yet.

ClLinearExpression opBinary(string op) (double constant)
{
static if (op == "+")
            return new ClLinearExpression(this, 1, constant);
        else
            static if (op == "-")
return new ClLinearExpression(this, 1, -constant);
            else
                static if (op == "*")
return new ClLinearExpression(this, constant, 0);
                else
                    static if (op == "/")
return new ClLinearExpression(this, 1.0 / constant, 0);
    }

I would just write it `else static if` all on one line and not indent further. Then it barely looks any different anyway.

Reply via email to