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
Description: PGP signature
