[openssl-project] Style guide updates

Benjamin Kaduk kaduk at mit.edu
Sun Jan 28 00:34:49 UTC 2018


On Fri, Jan 26, 2018 at 01:26:58PM +0000, Salz, Rich wrote:
> Some things I think we should add to the style guide.  Let’s discuss here.
> 
> No space after sizeof, use parens.  (But see ssl/record/rec_layer_{d1,s3}.c )
> 
> Multiline conditionals, such as in an if, should be broken before the logical connector and indented an extra tabstop.  For example:
> 
>     while (this_is_true
>               && that_is_not_false) {
>         frobit();
>         more_stuff();
>     }

To state it explictly, in the absence of the "extra" indentation
this would be formatted

    while (this_is_true
	   && that_is_not_false) {
	frobit();
	more_stuff();
    }

which is, as was noted, quite readable for the while() case, and
only if() has trouble.

> When dealing with long lines, try to avoid breaking across a function call. Don’t do this:
>     If (some_long_text && foo(a,
>          b, c) && bar()) {

And for this specific case, I am used to the rule being that if you
break mid-function-call, you indent to the paren for the function
call, as in

    if (some_long_text && foo(a,
                              b, c) && bar()) {

which rather inherently incentivizes not breaking across the
function call.

I read the rest of the thread and don't really have more to add to
it.

-Ben

> Instead do this:
>     If (some_long_text
>         && foo(a, b, c,)
>         && bar())
> 
> What else needs to be updated?
> 

> _______________________________________________
> openssl-project mailing list
> openssl-project at openssl.org
> https://mta.openssl.org/mailman/listinfo/openssl-project



More information about the openssl-project mailing list