bug-texinfo
[Top][All Lists]
Advanced

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

Re: declaring function pointers with explicit prototypes for the info re


From: Eli Zaretskii
Subject: Re: declaring function pointers with explicit prototypes for the info reader
Date: Sun, 16 Jun 2024 18:25:20 +0300

> Date: Sun, 16 Jun 2024 16:29:10 +0200
> From: Patrice Dumas <pertusus@free.fr>
> 
> In standalone info reader code in info/ most function pointers are
> declared as a generic function pointer VFunction *, defined in info.h as
> 
> typedef void VFunction ();
> 
> I think that it would be much better to use actual prototypes depending
> on the functions to have type checking by the compiler.  I started doing
> that and did not find any evident issue with having explicit prototypes,
> but I may be missing something.
> 
> Would there be any reason not to have explicit prototypes?

If the code passes function pointers to other functions, or stores
function pointers in arrays, the prototypes of the functions will have
to match each other and/or the functions they are being passed to.  So
beware when two functions of different signatures are placed into the
same array or passed as an argument to the same function, because the
compiler will at least emit a warning if not an error.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]