This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: __* in installed headers


On Tue, 11 Aug 1998 02:54:46 -0400, Roland McGrath wrote:
>> This is not what I said is guaranteed.  What is guaranteed is that the
>> internally used headers are a superset of the externally used headers.
>> I know that changing only one interface is troublesome.  But let's see
>> the case:
>
>That you answer in this way means I have failed to communicate my
>fundamental point.  The principle of conservatism is that we can never
>predictively enumerate the cases that may arise.  Where humans or the C
>preprocessor, let alone both, are involved, there can be no certainty of
>formal notions like a pure superset.  When I said it makes me uncomfortable
>to have the headers used when compiling libc and the headers used by user
>code not be the exact same files, that is exactly what I meant.  I can't
>predict the problem; I'm just quite sure that noone can positively rule out
>problems.  A little gratuitous paranoia is good for the digestion.
 
One issue - which might just be a maintenance headache but I think it may be
worse than that - is keeping track, inside libc, of which functions are
addressed as foobar() and which as __foobar().  I don't have the code in
front of me but I dimly remember that the sockets code was about half and
half.

This is why I suggested wrappers with #defines to be used when compiling
libc.  It would ensure getting the right symbol and would allow even
internal sources to be written with the public symbol names.

Fixing the libc vs. aux programs issue can be done simply: adjust the CFLAGS
for aux programs so they don't get libc-symbols.h, and have the wrapper
#defines predicated on _LIBC or analogous preprocessor symbol.  Aux programs
probably shouldn't have libc-symbols.h anyway.

As a related issue, I was thinking about a interface compiler, like MiG but
much simpler, for libc.  Its primary function would be to make cleaning the
namespace easier: you'd tag prototypes as C89, C9x, POSIX, etc. and it would
supply appropriate #ifdefs.  It could also automate keeping public and
private prototypes in sync.

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]