[openssl-project] Style guide updates
Richard Levitte
levitte at openssl.org
Fri Jan 26 16:44:51 UTC 2018
In message <2A47205B-D7F1-406B-B99B-D0139C075979 at akamai.com> on Fri, 26 Jan 2018 13:26:58 +0000, "Salz, Rich" <rsalz at akamai.com> said:
rsalz> Some things I think we should add to the style guide. Let’s discuss here.
rsalz>
rsalz> No space after sizeof, use parens. (But see ssl/record/rec_layer_{d1,s3}.c )
Yes
rsalz> Multiline conditionals, such as in an if, should be broken
rsalz> before the logical connector and indented an extra tabstop.
rsalz> For example:
rsalz>
rsalz> while (this_is_true
rsalz> && that_is_not_false) {
rsalz> frobit();
rsalz> more_stuff();
rsalz> }
Please don't call it a tabstop. extra indentation if you will, and in
that case, it should be 4 spaces inside the parenthesis.
Now, to have indent do that for us is a whole other story...
(side note: I saw an indent program a few days ago that's quite
promising. I'll dig it up again)
Frankly, I'm not sure I like this, and strictly speaking, it only has
visual value for 'if' conditionals, since the inside of the
conditional parenthesis is exactly 4 spaces in, and because we break
before operators, I don't see the visual problem, but that's a very
personal viewpoint, YMMV...
rsalz> When dealing with long lines, try to avoid breaking across a function call. Don’t do this:
rsalz> If (some_long_text && foo(a,
rsalz> b, c) && bar()) {
rsalz> Instead do this:
rsalz> If (some_long_text
rsalz> && foo(a, b, c,)
rsalz> && bar())
YES!
rsalz> What else needs to be updated?
--
Richard Levitte levitte at openssl.org
OpenSSL Project http://www.openssl.org/~levitte/
More information about the openssl-project
mailing list