Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2001-03-18 10:49:37


Comments on the condition.html example code:

* Excellent example. Good work!

* Don't #include <ll/ll.hpp> :-) Not accepted into Boost yet.

* Would class buffer be more self documenting if it was specified as:

      class buffer : boost::noncopyable

    (Not strictly needed because a member is already noncopyable.)

* Several variables could stand self-explanatory/better names. Maybe:

      p --> next_avail (or end)
      c --> first_used (or begin)
      full --> size_active
      buf --> circular_buf

    full is downright misleading; it sounds like a bool for
buf.size()==buf.capacity().

* The predicates (boost::var(ful)< buf.size()) and (boost::var(full)>0)
depend on ll/ll.hpp, so need to be changed:-(

* The need for inner scopes in send() and receive() are completely
non-obvious (to me, a naive reader). Are they needed? Why? How to know
what to include and what to exclude? Comments should spell out answers to
those kinds of questions. These inner scopes are scary as coded, without
any hint of why they exist.

* receiver() currently just knows (via hard coded literal) how many
elements sender() will send. That isn't very realistic or robust. Better
for sender() to notify receiver() of the end, via whatever mechanism would
be recommended for a real program.

Overall, very clear example!

--Beman


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