Re: mutt_buffer_concat_path is broken [PATCH: 1/1]
Alejandro Colomar via Mutt-dev <[email protected]> Thu, 7 May 2026 18:25:16 +0200
| Newsgroups | gmane.mail.mutt.devel |
|---|---|
| Message-ID | <afy8Bnk4JTkhwg2M@devuan> |
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>
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmn8vOYACgkQ64mZXMKQ wqmf3A//YeOUIIgsvbz8RQXDJXWUOXP9xNTzC4+6wYqwANM9M78a5Xa23wonFjpH SDYiSA57wdfDJvRAV52AMPV/Glostj5oK2a+XrIcfaM1wZgISq5jHgVKks0eTMcl d+EqThtdmDlHKB7tK0J1m96MbA0ULLFn9cLeCn1kVMX5YXN8+oPN5yxpty9mR9Bv ClzzzyO3Epkht3meaYAwoFK6RQ9tQmIqSfTeKO/p/iPGcp2mK8EOqQAoHzw645Fw BJyYdYMx/L3UDP7Ip1GOsp+EDcDV7MRAIcQZAXjkobtq4nxWWzj52s4ho4UkBCwF lrU25LbNG8kGAKw10VMh8bt9NP2DpLaHS4EBAE4Pd3E4Sg7jNtSZHAoJrf07qlEU LX4/wi2sthbmn6VGEBm/9CGLqU3FsNlf+30vIX0xkQBRy1eFJNq0wGEbAX/NsXyi mpDBywJFMqHVanMwTLe3aAHFNUeUziezNh8IapdN+2zFJwNpsaCaTA7H//0ivCSk gh+U591j74Q43otJlxT6cepUFyqpKpQ7ir4oAH8vQypKThm0yrBe38GgOh8s6IVB TDDAdoT53AsRkiJ4ZG7utXZk2ixFtw3I1GvoBjVI3XesLk4reZ0JqTB7HROxvBeO jQfnlWdbklENnoaqTojtF7ykDAb66ooa9t5UgCvfA45cr5fX1vI= =CzOW -----END PGP SIGNATURE-----