Re: On C99, C11, and other dialects

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

On 2026-04-21T23:27:43+0100, Ian Collier via Mutt-dev wrote:
> On Tue, Apr 21, 2026 at 11:35:38PM +0200, Alejandro Colomar via Mutt-dev wrote:
> > And here's the one from the Linux man-pages project:
> > 
> > 	SYNOPSIS
> > 	     #include <signal.h>
> > 
> > 	     typedef typeof(void (int))  *sighandler_t;
> > 
> > 	     sighandler_t signal(int signum, sighandler_t handler);
> 
> > The latter still uses typeof() --even if it also uses typedef-- for
> > reasons similar to malloc_T().  If we didn't use typeof() in that
> > typedef definition, it would become quite unreadable.
> 
> typedef void (*sighandler_t) (int);
> 
> It doesn't seem that unreadable and it's also shorter (although
> declaring pointers to functions is tricky for the uninitiated).

Yeah, once you get used to it, it's relatively acceptable, as long as
there's only one level of function pointers.  Two levels is too much
--that would be signal() itself, if not using the typedef--.

> Indeed, the man page for sigaction(2) still uses that style of
> definition on my system [man-pages-6.13].
> 
> Ian Collier.
> 
> PS incidentally I don't have signal(3 anything) on my system - sections 2 and 7
> only.

signal(3posix) is in manpages-posix-dev in Debian.  The POSIX manual
pages are don't have a DFSG-compatible license, and thus some distros
don't package them, and others package them in non-free repos.

	$ apt-cache show manpages-posix-dev | grep ^Section:
	Section: non-free/doc


Have a lovely day!
Alex

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

iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmnojDkACgkQ64mZXMKQ
wqlq5g//WKlASfOyz80cSpm2AZWC/qKqrsgHYp0ib4c2H3yWfdFHfCZ8/+7pD3Li
ysny9EiDqG/wsd1wLNRyVvlGxOZe7FGBUC72nxLPf2Uhxtj4NmQwI3nRvsKAQRM8
JJS6mtxCvT51ap6o2dC1nkIlF49WPR7ZYtJeNSzDrhTBw+HTzo+icQ4aHqA4t+X/
vP+WN5I3RU/ekUBPpe+TOEM6mfKUw83FvdKwNwXWJQmdobafApnw4kiz9KK5Q8f3
nroUgCRrN3FCGhsaYYIGqMmDR1VL4YPGK2CPG/zFv226a2ZHhaMcIMrHNLsSd9fs
MiIhREkL7iMssrfnCetqc2DJwFICoPw8p2fLu7AzVTSsGxjYcFrOZTvcFV393Hnu
kWmxyH3tmhxdqLDTc6E4c2p7M5OZWRhO3IokSB27pUylyC+yrrAmso08GJDELzlg
BvMYvqWZzH+SUfzzVbOfNgaACmlOqXt1Jh6gW7k5gtWxa4GjhWA5tYUph5easxQV
Qdi8GaabCskX4JkaA4hzc/INRdJ7jvTwP12lUFNbjjT8Lask3291/qNtqMO0RuTV
bnT7TxfmSu5vqN2bmcTv9dlRkfivuXczYt9HQl/8rp4cady4osJ/Duo9zBIFBtsD
s3sOiOXmmspTs5iN1kQwL6SAN4OaiRenCSAwXGhu9QtRXISv2vU=
=jTHB
-----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.