Hi Derek,

On 2026-05-07T12:19:57-0400, Derek Martin wrote:
> On Wed, May 06, 2026 at 11:15:19PM +0200, Alejandro Colomar via Mutt-dev 
> wrote:
> > To be honest, I find the code below completely unreadable.
> 
> That's a fair criticism, I didn't spend enough (any, really) time
> trying to simplify the logic.  Simplification was definitely possible.
> The second version is much clearer, I think.
> 
> FWIW, I found yours no more readable, mostly because the logic was
> spread across too many layers.
> 
> 
> On Thu, May 07, 2026 at 05:44:56PM +0200, Alejandro Colomar via Mutt-dev 
> wrote:
> > On 2026-05-07T11:21:35-0400, Derek Martin wrote:
> > > > Allman curly brace style, being free to omit the braces for
> > > > single lines if you like.
> > > 
> > > Due to past experience, I don't do this unless the conditional statement 
> > > fits
> > > comfortably on the same line as the conditional.  It tends to lead to
> > > bugs where someone expands what is done conditionally (or tries), but
> > > they forget to add the braces, leading to a hard-to-see logic error.
> > 
> > This is not a real problem, and has not been a real problem for many
> > years (if not decades).  -Wmisleading-indentation exists since GCC 6
> > (released in 2015), and is part of -Wall, and it precludes the
> > possibility of such logic errors.
> 
> No it doesn't, because not everyone is compiling on modern systems,
> not everyone compiles with -Wall, and though mutt does, it doesn't
> compile with -Werror, and not everyone reads (or always notices)
> warnings.

That's not necessary.  As long as 1 person compiles on a "modern"
system (I wouldn't call GCC 6 modern anymore), they'll see the bug and
fix it for everyone else.  Unless it's conditionally compiled code that
is disabled on any compiler of the last 11 years, someone will notice.
(Which is why conditionally compiled code is something to avoid in
 general.)

I think it would be good to add certain -Werror= flags by default, such
as -Werror=misleading-indentation.  For those that have no false
positives, it's objectively good, as you've hinted.


Cheers,
Alex

-- 
<https://www.alejandro-colomar.es>

Attachment: signature.asc
Description: PGP signature

Reply via email to