[openssl-project] Style guide update -- summary so far

Kurt Roeckx kurt at roeckx.be
Mon Feb 5 22:48:15 UTC 2018


On Mon, Feb 05, 2018 at 08:43:04PM +0100, Dr. Matthias St. Pierre wrote:
> 
> 
> Am 05.02.2018 um 19:13 schrieb Salz, Rich:
> >  
> >
> > Do not put a size after sizeof; do use parens.
> >
> 
> nit: Do not put a /space /after sizeof.
> 
> >  
> >
> > Treat a single-statement with comment as if it were multi-line and use
> > curly braces
> >
> >  
> >
> >                 if (test()) {
> >
> >                     /* already alerted */
> >
> >                     close();
> >
> >                 }
> >
> >  
> >
> 
> Wasn't there also the suggestion by someone that if one part of an
> if-else statements needs braces that the other part should get some, too?
> 
>     if (foo)
>         do_this();
>     else
>         do_that();
> 
> vs.
> 
>     if (foo) {
>         /* some statements */
>         ...
>     } else {
>         ...
>     }

As already pointed out by others, it's mostly already in the style
guide. What is not in it is the combination with a comment:
    if (foo)
        /* some comment */
        do_this();
    else
        do_that();

And it's been suggested to use curly braces for that.


Kurt



More information about the openssl-project mailing list