[coreboot] Proposing a change to Coding Style

Jonathan A. Kollasch jakllsch at kollasch.net
Wed May 16 17:23:12 CEST 2018


On Wed, May 16, 2018 at 05:15:44PM +0200, Patrick Georgi via coreboot wrote:
> Hi everybody,
> 
> after just running into an issue on the EC code base, I hereby propose that
> going forward, we should always wrap conditional blocks in braces, even
> one-liners.
> That is:
> 
> if (foo) {
>    bar();
> }
> 
> instead of
> 
> if (foo)
>    bar();
> 
> It doesn't hurt too much but saves us from accidentally adding baz() after
> bar(), forgetting to add the - now required - braces. If we get rough
> consensus over this, I'd change Coding_Style to match.

I whole-heartedly endorse this proposal.

I was recently disappointed to see these braces being removed from code
that I wrote.  I had included these braces based on the same reasoning
you use here.

At the very least, I would like to see the coding style not forbid
these "extra" braces.

	Jonathan Kollasch



More information about the coreboot mailing list