Boost logo

Boost :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2005-10-16 23:10:08


Hi,

--- RocWood <rocwood_at_[hidden]> wrote:

> Yet I still have a little complain that "header files only" makes
> the compile process slower and slower with the functions of asio
> grow more and more.

In the longer term I plan to support a separate library (possibly an
optional one) that keeps system headers away from application code
(i.e. to prevent the namespace pollution that system headers sometimes
introduce). However this is not currently a high priority for me as it
doesn't affect asio's API.

In terms of compile times, my testing indicates that, on Windows with
MSVC, windows.h and friends are responsible for at most 30% of the
compile time. The rest comes from asio + standard library headers, and
the fact that it uses templates extensively.

In 0.3.4 I do now test that every public asio header file can compile
on its own, so you can probably gain some improvement in compile time
by only including the headers that you need, rather than the catch-all
asio.hpp.

> Furthermore, I guess that it use static class
> member initialization for win32 socket WSAStartup, which seems to
> be a potential occasion for users to make a bug(just guess, not sure)
> while more than one c++ source files include asio headers.

This should be ok, as it's a static member of a class *template*. In
cases where multiple definitions cannot be avoided (e.g. multiple DLLs
using asio) the multiple initialisations of winsock should still work
just fine (although there may be a memory leak per definition).
 
> Would you please consider a header+source version with clean and
> simple header files ?

I do understand the desire for short, clean header files :) However the
main problem is that to do that I would have to abandon any hope of
supporting older compilers like MSVC6. At the moment I believe that a
large and still useful subset of asio will work for MSVC6, but MSVC6
does require that you put member template function definitions inside
the class definition. I'm not ready to give up on it completely... yet
;)

Cheers,
Chris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk