Boost logo

Boost :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2007-04-02 13:18:59


> -----Original Message-----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Jeff Garland
> Sent: Monday, April 02, 2007 8:41 AM
> To: boost_at_[hidden]
> Subject: Re: [boost] [system] Why is this not header-only?
>
> Sohail Somani wrote:
> > Oh gosh yes. Having things in headers because it makes it
> 'easier to compile' hurts compile
> > times in the long run.
>
> Get a faster build machine and/or use pre-compiled headers -- really.

Seems to me you're saying replace something that is a bit annoying
(compile it yourself) with something that is even less likely to be done
correctly. But your point is well taken, and that is something I should
look into. However, one should still prefer a codebase that doesn't
require the user to make up for slow compiles with these
compiler-specific features.

> > Its just not good practice and I suspect a non-empty subset of new
> > boost users are also new to C++.
>
> 5 years ago I believed it was a serious issue too -- I've
> substantially
> changed my mind. And not in small part by using asio (and
> other boost libs)
> as header only. It's extremely nice to not need to figure
> out how to build
> and link. You can get started with so trivially with an all
> header library --
> and I think that frequently it's trouble getting over that
> first hump that
> stops people from using libs. So if the barrier is lower
> more people will use
> the libs.

But if you have a policy of saying: don't make your build totally
dependent on bjam, I don't think this is an issue. Just add the cpp
files to your build and off you go.

In my opinion, bjam is the biggest obstacle to new users. If the
instructions for using boost thread (for example) were this:

0) Create a new VS.NET project
1) Add the files in boost/libs/thread/src to your project
2) Add the include path for boost to your project (with some
instructions on how to do so)
3) Copy and paste the following into main.cpp

This is a non-issue. With header-only libraries, step 1 is the only
thing that disappears and you might even be lucky enough to disable
language extensions in your project.

Sohail


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