[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: asymmetry
From: |
Bruno Haible |
Subject: |
Re: asymmetry |
Date: |
Sat, 18 Oct 2008 15:18:36 +0200 |
User-agent: |
KMail/1.5.4 |
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.
Bruno
- netdb.h, Simon Josefsson, 2008/10/15