Boost logo

Boost Users :

From: Matt S Trentini (matt_s_trentini_at_[hidden])
Date: 2003-11-11 20:32:13


Heya Jorg,

> The corrected code is indeed much better. May I suggest using
> std::vector instead of vector?

I considered doing this but decided not to. I felt (and still feel) that in
a presentation it just adds noise. The presentation is really there to show
concepts about using the boost library, not all the implementation details.
Having std there simply makes the example harder to read in my opinion.

You'll notice I've fully qualified some other namespaces where I thought
that there was ambiguity.

> As for the correct output, my compiler gives me 3, then 2, then 1. I
> talked it over with a friend, and I guess the order of the 2 vs 1 is
> undefined, and depends on your STL's implementation of std::vector.

Yep, Ben Hutching made this clear to me too - I should have known better.
Will fix! :)

> As for the crazy aunt in the basement, the comment was meant for an
> internal list that only 20-30 people are on, not meant for general
> consumption, and probably merits an extra thread by itself. Put simply,
> using boost can generate a surprising amount of code and overhead. This
> is true of STL as well. There are even some good books describing STL;
> I happen to like Plauger/Stepanov/Lee/Musser, as well as Jasoutis. But
> nowhere do I see any reference as to what the downsides are - and
> nowhere do I see any concise explanation of why an enormous amount of
> code (660 bytes in an optimized, no-symbols build) is generated when I
> say something as simple as
>
> void Testbed(void) {
> boost::function<void> SimpleFPtr(&Testbed);
> }
>
> When you say "I was trying to generate interest in these libraries and
> thus didn't want to focus too much on the negatives", I can understand
> your point of view, but what I see in real life is that people start
> using boost::function everywhere they used to use plain old function
> pointers, with nary a clue that their code size just exploded with no
> benefit.
>
> But like I said, it's worth a whole other thread.

You make a valid point but I don't underestimate my peers - they're pretty
cluey people who will figure out the issues. Especially when the Boost
community generally goes to a fair effort to make limitations known.

Like you said it's a whole thread in its own right - my take is that you
shouldn't worry about optimising too much until your profiler tells you
otherwise (Herb Sutter would be proud!).

> Thanks for fixing the code and responding so quickly!

No worries - thanks for taking the time to give feedback!

Cheers,
Matt

PS I don't own the Plauger/Stepanov/Lee/Musser book though the Josuttis
text, and Meyers Effective STL, come highly recommended for STL development.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net