tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: -mdoc: how to handle surrounding types?



On Thu 08 Feb 2024 at 23:59:24 -0500, Mouse wrote:
> I'm writing a manpage for a library and want to describe a function
> which returns a pointer to a function.

signal(3) has a similar case, right? And it spells out the type in full.
So you could look there for inspiration.

However I would prefer that it would make a typedef for the signal
handler type, and use that both as argument for signal() and its return
type: it us much more readable. For your case that would be true as
well.

> Specifically, it takes a handler of type void (*)(const char *, int)
> and returns the previous handler.  If we call it foo, then:

typedef void (*handler_t)(const char *, int);

> extern void (*foo(void (*)(const char *, int)))(const char *, int);

extern handler_t foo(handler_t);

> How should this be described in SYNOPSIS?  The .Ft/.Fn paradigm does
> not seem to me to have any obvious way to describe function return
> types that aren't textually entirely before the function name, that is,
> which don't fit the textual paradigm $RETURNTYPE $FUNCTIONNAME($ARGS).

With this rephrasing it should fit better.

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert                            <rhialto/at/falu.nl>
\X/ There is no AI. There is just someone else's work.           --I. Rose

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index