[llvm-dev] Codifying our Brace rules-

James Courtier-Dutton via llvm-dev llvm-dev at lists.llvm.org
Mon Jun 29 14:33:03 PDT 2020


Hi,

For safety and security, I would probably recommend the rules as per Misra C++
The Misra C++ standard not only explains the rules, but also the
safety and security related reason they are the way they are.

Kind Regards

James


On Mon, 29 Jun 2020 at 22:18, David Greene via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>
> Chris Lattner via llvm-dev <llvm-dev at lists.llvm.org> writes:
>
> > For those who don’t like it, is the currently documented policy broken
> > enough to be important to changing?
>
> I believe it is, simply for safety reasons.  Adding a statement to a
> single-statement block can introduce bugs.  Mandating braces everywhere
> prevents that.
>
> > I assume you wouldn’t recommend a massive rewrite of the codebase, so
> > we’re going to be with this for quite some time.
>
> Sure, that's unavoidable.  But as code changes we can add braces where
> they're missing and reviews should catch cases where we forget.
>
>                   -David
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list