Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2007-01-03 11:35:07


"Emil Dotchevski" <emildotchevski_at_[hidden]> writes:

> I don't think it is unreasonable to require that users register each class
> and archive type before they use them together. If portability is not a
> problem for someone, they can stick this registration in a global object in
> the cpp file that defines the class, and suffer later when they port to
> another system.

More work than necessary. Ensuring a particular TU's initializations
are done is trivial. It's just that the library can't (portably) do
it for you.

> Even if portability was not an issue, I would still do the registration
> "manually". I don't think the author of class foo should be the one who
> decides whan archives will be used to serialize objects of class foo.
> Besides, what if I want to use class foo but I will never serialize it? The
> physical coupling introduced by the "automatic" registration will link all
> kinds of dead code to my executable. No, thanks.

No need to be concerned with that; you can put the uses of EXPORT in a
separate header that includes the other header.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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