The reason to a style guide is not that one style is inherently
better than another.  It is because consistency makes the code
easier to read for anyone familiar with that style.  Part of that
means using common idioms that are immediately recognizable by
someone familiar with the style.  This reduces the amount of time
is takes someone to understand the code.

We want to make the code easy to read, since time spent in maintenance
is much greater than the time spent initially writing it.  This
means that being clever when writing code is a _bad_ thing if it
reduces readability.  There is plenty of use of the ternary operator
in the OpenBSD code base but it tends to be used sparingly.  Nesting
the ternary operator must be done with care due to C's operator
precedence.  We've seen bugs in the past due to this.

In other words, just because you can doesn't mean you should ;-)
What one person finds clear and obvious may seem obfuscated to
someone else.  We try to use a consistent style so that everyone
can read and understand the code once they are familiar with that
style and common idioms.

 - todd

Reply via email to