[ldns-users] Missing or incorrect prototypes

Paul Wouters paul at nohats.ca
Tue Apr 9 19:06:45 UTC 2013


On Tue, 9 Apr 2013, Dag-Erling Smørgrav wrote:

> Willem Toorop <willem at nlnetlabs.nl> writes:
>> Dag-Erling Smørgrav <des at des.no> writes:
>>> It still needs a prototype:
>> This helper function is not intended for use by the public.  It has no
>> place in the public API.
>
> Then provide a prototype in a separate header which is only used
> internally.

Or better yet, see if you can make the function static?

> The C standard.
>
> C doesn't have as many distinct name spaces as you'd like, so using a
> particular identifier as an argument name in a header file restricts
> what a source file that includes that header file can use that
> identifier for.  This is why people do stupid things like:
>
> foo.c: int foo(int a, int b) { /* ... */ }
> foo.h: int foo(int _a, int _b);
>
> so foo.h won't "steal" a and b from the application, but this just
> replaces one error with another (_a and _b are in a namespace which is
> reserved for the implementation).  It is better to just leave out the
> name entirely.

Interesting. I should look into this....

> 2) Your users shouldn't have to refer to the headers anyway.  That's
>   what man pages are for.

If only I was allowed to delete every binary and header file that has
no man page, or a man page refering to the info pages, or other man page
placeholders, along with binaries that do not have -h, --help, -v,
--version

Paul



More information about the ldns-users mailing list