[poppler] Do we want to enable readability-braces-around-statements ?

jcupitt at gmail.com jcupitt at gmail.com
Thu Mar 3 08:59:02 UTC 2022


gcc at least (clang too I think) will warn for misleading indentation,
so I think forcing braces probably won't add much extra safety.

Braces for single lines adds extra visual noise and reduces the code
you can see at a glance, so some people argue there's actually a small
downside to using them. I believe Chrome's code standard requires the
removal of braces on single lines for this reason.

(Of course this is a minor bikeshedding issue and it doesn't matter much.)

John

On Wed, 2 Mar 2022 at 23:39, Albert Astals Cid <aacid at kde.org> wrote:
>
> It forces to add a pair of {} to all if/for/while/etc
>
> https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/1091
>
> (it fails in Qt autogenerated files for now, i can fix that if we agree we want it)
>
> I can see it being potentially annoying when CI fails because of this but on the other hand it seems it's always safer to include the braces to not fall into the trap of adding a line indented but that it's not really inside the if block
>
> What do you'all think?
>
> Cheers,
>   Albert
>
>


More information about the poppler mailing list