Content deleted Content added
Moggie2002 (talk | contribs) m →Result type: correct presumed typo |
Moggie2002 (talk | contribs) m →?: in style guidelines: Add note that appropriate use reduces the probability of buggy code vs. its less concise counterparts |
||
Line 70:
Some corporate programming guidelines list the use of the ternary operator as bad practice because it can harm readability and long-term maintainability.{{Fact|date=November 2007}} However, when properly crafted the ternary operator is no more difficult to debug than the <code>if</code> statement equivalent (and in fact shouldn't require any debugging at all).{{Fact|date=November 2007}} Ternary operators are widely used and can be useful in certain circumstances to avoid the use of an <code>if</code> statement, either because the extra verbiage would be too lengthy or because the syntactic context does not permit a statement. For example:
[[C preprocessor|#define]] MAX(a, b) (((a)>(b)) ? (a) : (b))
or
Line 88:
feet;
</source>
This is
== Inconsistency of Implementations ==
|