Boost logo

Boost :

Subject: Re: [boost] [function] "paranoia" vs efficiency
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-10-29 08:33:59


Domagoj Saric wrote:
> "OvermindDL1" <overminddl1_at_[hidden]> wrote in message
> news:3f49a9f40910021215g981da6cxd93c43ac52fee5cc_at_mail.gmail.com...
> > That is something I have been curious about since I first looked at
> > the Boost.Function source. I was curious why it did not
> > use any real policies like most other things in boost
>
> it seems to me rather that there is no "clear cut" policy
> (pardon the pun :)
> about that (the policy approach) in boost...for example the shared_ptr

Of course not. It is up to each library developer and depends upon the purpose and audience of the library besides.

> documentation states that shared_ptr uses a more joe sixpack
> approach with a
> "forced" dynamic deleter on purpose, to achieve a simpler
> interface and a more
> 'stable' abi (the point seems moot imho, the same could be
> achieved with
> default template parameters while retaining compile-time
> configurability)...

The same could not be achieved with defaulted template arguments. The idea is that, regardless of how something is allocated and deleted, the shared_ptr type only depends upon the type it points to. That permits interoperability among a great deal more code such as in Windows when a DLL uses a different RTL than the application.

> > And I *love* the idea about using a nop static func that throws, or
> > perhaps asserts, all depending on policy settings for example. :)
>
> well...here it is..."and more" ;-)
>
> the boost::function documentation states that virtual
> functions are not used
> because they cause code bloat but comparing the actual
> binaries and code
> generated i found boost::function to actually be worse in
> that respect than the
> std::tr1::function implementation provided with msvc++ 9.0
> SP1 (that does use virtual functions)...

The claim was made years ago and is for a library that doesn't have the benefit of being written by those with direct access to those writing the compiler. It may be that things have changed and that another approach is superior now, as your analysis of std::tr1::function in MSVC 9 SP1 suggests.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


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