[coreboot] Proposing a change to Coding Style
Julien Viard de Galbert
jviarddegalbert at online.net
Fri May 18 14:54:24 CEST 2018
> Le 16 mai 2018 à 17:15, Patrick Georgi via coreboot <coreboot at coreboot.org> a écrit :
>
> 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.
>
>
> Thoughts?
> Patrick
> --
> Google Germany GmbH, ABC-Str. 19, 20354 Hamburg
> Registergericht und -nummer: Hamburg, HRB 86891, Sitz der Gesellschaft:
> Hamburg
> Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
>
> --
> coreboot mailing list: coreboot at coreboot.org
> https://mail.coreboot.org/mailman/listinfo/coreboot <https://mail.coreboot.org/mailman/listinfo/coreboot>
Hello everyone,
Not that my opinion matter most (I’m just a newbie after all) but:
I really like this proposal. And agree that this is error prone. I also like the
} else { option.
Remember that the script that check commits is enforcing removing the braces,
I was hit by that when porting the code for denverton.
As a side note, There is also a 80 column limit, I was told that printf format
string can exceed the limit but the script complains…
Just saying that the script should be updated if the policy is changed.
Best Regards
--
Julien Viard de Galbert - jviarddegalbert at online.net
Online / Scaleway
Looking for an amazing job? Join us NOW ! https://careers.scaleway.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot/attachments/20180518/2dbfecb4/attachment.html>
More information about the coreboot
mailing list