[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: asymmetry
From: |
Simon Josefsson |
Subject: |
Re: asymmetry |
Date: |
Sun, 19 Oct 2008 09:35:44 +0200 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux) |
Bruno Haible <address@hidden> writes:
> Simon Josefsson wrote:
>> Thinking about this, there is some asymmetry between structures and
>> functions in gnulib: to get a function from a header file, you need to
>> pull in a module for that function. To get a structure from a header
>> file, whether you need it or not, you pull in a module for the header
>> file. This creates some excess dependencies, as can be seen here (netdb
>> wouldn't have to depend on sys_socket). If there were a 'hostent'
>> module to get the 'struct hostent' declaration from the netdb.h file,
>> the netdb module wouldn't need to depend on sys/socket.h, and the
>> 'hostent' module could depend on the sys_socket module to get that
>> definition on MinGW. However, this appears to be established procedures
>> in gnulib though, but it can be useful to be aware of this.
>
> The origin of this asymmetry is probably that:
>
> 1) People look at the code size of their executables and shared libraries,
> and don't care much about the size of the distributed tarball (thanks to
> autoconf :-S). Therefore an additional dependency is not much of a problem.
> Whereas an additional compiled function increases the code size.
>
> 2) It's expected that programmers can detect the list of modules they need
> by looking at their source code: which are the #include<>s, and which are
> the function calls ("nm")? When a programmer sees a '#include <netdb.h>'
> it is immediate for him to infer that he needs the 'netdb' module. But
> it takes more investigation to detect which _parts_ of <netdb.h> he needs.
Right, and it is likely a good trade-off until we know of valid reasons
to work on changing this.
/Simon
- netdb.h, Simon Josefsson, 2008/10/15