[openssl-project] Style guide updates

Andy Polyakov appro at openssl.org
Sun Jan 28 13:22:40 UTC 2018

> Multiline conditionals, such as in an if, should be broken before the
> logical connector and indented an extra tabstop.  For example:

One can wonder if it would be appropriate to explicitly say that
preferred way to organize multi-line conditionals with same chain
condition per line even if pair of them fit into line. I mean

    if (this-is-long
          && that
          && even-that)


    if (this-is-long
          && that && even-that)

with first example being preferred. And this is even if 'this-is-long'
is short.

[Or should one tolerate following provided that 'this' is short enough?

    if (this && that
          && even-that)

Either way, suggestion is that *if* you find yourself breaking condition
to multiple lines, you should take it step further, if not all the way.
But it shouldn't preclude things like

    if (this-is-long
          && (that || (even-that && not-the-one))
          && don't-forget-this)

This actually means that one should be able to write second example as

    if (this-is-long
          && (that && even-that))

but it would imply that logical relation between 'that' and 'even-that'
is strong enough to justify the parentheses.

[Also note that in above examples additional indentation is just two
spaces. It's not a coincidence, it's also kind of suggestion, for
if-specific indentation.]

More information about the openssl-project mailing list