Re: clang-format
"Kevin J. McCarthy" <[email protected]>
| Newsgroups | gmane.mail.mutt.devel |
|---|---|
| Message-ID | <abYcAoNbHOJKzT1b@qinghai> |
On Sat, Mar 14, 2026 at 03:29:39PM +0100, Alejandro Colomar via Mutt-dev wrote:
>On 2026-03-14T18:47:18+0800, Kevin J. McCarthy wrote:
>> > AlignAfterOpenBracket: Align
>>
>> This is generally the case in the Mutt code. I think overall it looks nice,
>> but there is the trade-off with long function names and/or deep indention
>> where parameters start to not all fit within 80 columns.
>
>I tend to prefer manual adjustment of this. Most of the time, it's
>reasonable to use the automatic alignment, but every now and then I
>decide to differ for some reason.
Yes, this seems to be the problem with format tools. AFAICT, there are
just two options, true and false. I don't think there is a way to say
"let them be", but please correct me if I'm wrong.
Rene voiced a dislike of formatters, especially when they are run
automatically on a pipeline. Perhaps we could run this formatter once,
clean up the egregious function alignment issues, and then just leave
the format config as "reference"?
>> > SpaceBeforeParens: Always
[...]
>I dislike this. It becomes especially bad when nesting calls. Here's
>for example some code I had to write for GCC, and how I would have
>written it without the mandatory spaces:
>
> _Generic (typeof (_Maxof (const int)), int: 0);
> _Static_assert (_Maxof (unsigned _BitInt (5)) == 31);
>vs
> _Generic(typeof(_Maxof(const int)), int: 0);
> _Static_assert(_Maxof(unsigned _BitInt(5)) == 31);
>
>The argument list is fundamentally attached to the function, and the
>lack of space makes that more evident to the eye. That separate (5)
>seems lost, where it is in reality the argument of _BitInt().
I won't argue with this. I'm used to the space before the parens now,
after a few years of working in the code. But when nested calls take
place, I agree that it becomes unreadable. And unfortunately the
formatter does it for gettext parameters too, so we have calls like:
getFoo (_ ("hey there"), 1);
which I think looks terrible.
I'm still very reluctant to change the default format after so long.
But if I heard from some of the Mutt old timers in support, perhaps we
could take the plunge...
--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEiXWpszqjeRA4XFMIre92hIAxa9oFAmm2HAIACgkQre92hIAx a9riYRAAjJr4qDEZqGnoblrw45OZYQcNbp5Ho4Iydzzse29mUVCMqqVaNDeCAUXl f9z2Xpktv1UlP+LbN+lO6nSKpSCGf2XED2tSNgCiXfomits3FQwEs70t60eR79/p hYTx4aOcSrskp0BAO0EW5NbiJhBfLhNcuYAm/weRqNW03rgCpv+7lgagzuOoK+En fEOhlqCWObTq2bSQzN79h1XuYsCrM0G5Lh+lxToroGU7GOz31obDizH11wRmI7gO 5Z/enzVD525ClVwELZCqaI5wo9Br1a8mwKTn5AtH8E+Bk35Ii8SmKeMv2SHqu+cU brgEmkiBF970+F2q5kgv9OirO9+znGfYErOolooFwFUK5UWIp+CGtcqDUKTpFZeJ hnF+Ty4UmeNtQU18+ehh92N5CEUTEz6mtQrCTtozd/OJ6kXh7W/unNm2k0x3Uswr Q+gfU1N8mlJIWVtVsymKYZEgV58Ek4AKdTMy3wJ/C5ZoPqHHl4CVEcIcSqaLgBcT 2LPdIUa4KMxi8l9rw3T41FDzWin88x350ezHr9T65Kfu3uiId4UBdst+RSVus8kw hOkNWI6GSIJMBVvWFafEoOAwpIr+Sp3kx288a6m1gZ9LKU/kpInQ1fixY8WFr2n7 wSErHUkuumL6NGR/sxKhH+5X7XdfwALhdF3etT2iHC6A4bmnr7g= =JE5R -----END PGP SIGNATURE-----