Re: clang-format

Alejandro Colomar via Mutt-dev <[email protected]>
Newsgroups gmane.mail.mutt.devel
Message-ID <abVtHrBjCCI4IhmZ@devuan>
Hi Kevin,

On 2026-03-14T18:47:18+0800, Kevin J. McCarthy wrote:
[...]
> > ColumnLimit: 80

+1

[...]
> > SpaceAfterCStyleCast: true

+1

> I think this is generally the case in the mutt code but it's not uniform.  I
> don't insist on this one.  Definitely open for discussion.

I find it easier to grep(1) for casts when they are consistently
followed by a space.  Otherwise, (type) is just too common to
distinguish a cast from something else.  And it's certainly useful to be
able to grep(1) for casts, given they're among the most dangerous
features in the C language.

> > IndentGotoLabels: false

+1

> There are both styles in the code.  Also definitely open for discussion.
> 
> > KeepEmptyLines:
> >  AtEndOfFile: false
> >  AtStartOfBlock: false
> >  AtStartOfFile: false
> 
> It seems like a good idea?  Please say something if in your experience this
> isn't.

It sounds reasonable.

> > 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.

> > SpaceBeforeParens: Always
> 
> I know this one is controversial.  It took me a while to get used to the
> function definition and declaration style in Mutt.  It's not very standard,
> so I'd appreciate some other viewpoints, but let's not get bogged down on
> this one, okay?  I'm most likely not up for changing it unless I hear
> old-time devs chime-in against it too.
> 
> Anything else I missed or you see that's a bad idea?  Please speak up. Thank
> you.

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().


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es>
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmm1cM0ACgkQ64mZXMKQ
wqlKjQ/+M9a03mIBnFCCpLYe7rRTOvRefG0nM9L+rgSQkv93hPri+sRL6lE44IcA
O7hiRo1YGF0oPDXj9ID5msFx9YNJWu3MRvVxUrlDydkqsQjT8TNMWvkBgoEHAOgn
wdl7der7ZO7XPkNPeembNI5pRkyo5I2TNLZjeqZAg+34s7reyKljpa8Ky1P81uHb
BGcLvs7shD5Lx7tjZ36RaSa8Bdwa1gO4AobimTANIeKlY7wmysB90Vp7g8HHmbVV
4PVVsGWIdiJgiFhFplEZTcLNozmuSBDNVnOAlLE/k1RNhl5jwCYSgoX8CCXnm1L7
CXxoP8siEuK+xKP4SIFHgUVHJWW/F1Aw4nnrGRVP7tdUQnqofnldi6JKALv+a0Sl
ctDOD76CoxNah+dTCx6m7Dvr8MZw+coWy1OH2uKtb66TpOXhJaw+jc/AsnnIZxtA
6uNLs8xkl/QrtFAFxy27AGaXd8lNdqQriUYnbQwMN47txEEX3EHZl4FE1YoP/mCI
9omp+gVtKlT52eydtkn8lPe7HIav4W7fRZFNWNga+FFLfTM18k2HWa4fEQlUQev0
yJiqZbpiZGPdPjHuGCwmnFsjWTdIhEtW9UrPpYCDxk0AUvY1Ae1KUMDcO3sWHbry
CjqXNNnOZec4Hk/3HTFtNPf3eYtiMwBSmQejD5JCwFecHjL0w04=
=JSyp
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.