Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 29 Feb 2016 15:17:24 -0500
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] add sched_getcpu

On Mon, Feb 29, 2016 at 11:10:51PM +0300, Alexander Monakov wrote:
> On Mon, 29 Feb 2016, Rich Felker wrote:
> > > > Policy is to always include the header with the public declaration
> > > > (and any feature test macros necessary to get it) so that the compiler
> > > > checks the implementation against the public declaration.
> > > 
> > > This policy certain makes sense; I pointed that out because I've seen it
> > > violated; at least the following files violate it by defining something
> > > without including anything:
> [snip]
> > > src/internal/procfdname.c
> > 
> > This is an internal function.
> 
> Please explain the difference in policy for internal functions. The original
> motivation (compiler checking the prototype) sounds like it's valuable for
> internal functions too.

I agree there's value to both, but as stated ("...public
declaration...") the policy only applies to public APIs. Part of the
difference that makes it more important is that we're actually
checking the correctness of the prototype, which is an error that
would leak into programs compiled against musl's headers if it's
wrong, whereas for internal functions the bug from a mismatch is at
worst an internal bug.

With that said I agree it would be nice to have prototypes checked for
internal functions too, but some of them don't have a natural place to
put the prototype without adding gratuitous tiny header files or
lumping more stuff into the existing internal headers. This is
probably an area that could use some thought to cleanup.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.