Please remove ?:

Ivan Kazmenko gassa at mail.ru
Fri Jun 2 11:55:54 PDT 2006


>Please remove ?:... It's useless, slow (just like if/else, but looks 
>faster since it's so "convenient") and unreadable!
Well it's slightly less readable than if..else because of operator precedence
issues. However, it's the responsibility of the program author to make it clear,
and there are situations when it's convenient to use branched result as an
rvalue. These are what ?: is for.

What makes me wonder is why ?: looks faster. Does * look faster than /, then?
Yet, it is on modern PCs. In my humble opinion, a programmer should not,
generally speaking, judge expressions' performance by how many words or keywords
are used.

Ivan Kazmenko.



More information about the Digitalmars-d mailing list