bearophile:
> I agree, that's why I have added two more points

The precedence of the ternary is pretty easy to handle - if there's
more than one thing in there, just use parenthesis. That's the
only thing I can think of that would make it any more bug prone
than other branches.

Perhaps it'd be worth thinking if parens should be required in any
non-trivial cases.

auto a = something ? "one" : "two"; // ok

auto b = a ~ something ? "one" : "two"; // error, please add parens for clarity

> - It is less maintainable

I don't agree that changing to an if is any burden at all. This
is like saying "if(x) y;" is unacceptable because you might have
to add braces later.

Real maintenance headaches are things like duplicated code
or unnecessary complexity. This is just a very simple case of
syntax translation.

Reply via email to