Boost logo

Boost Users :

From: Gavin Lambert (boost_at_[hidden])
Date: 2020-06-03 08:06:16


On 3/06/2020 18:22, Emil Dotchevski wrote:
> Therefore, the documentation can just specify that a rope is as thread-safe as an int.

I strongly dislike the phrase "as thread-safe as an int" because it's
often applied to structures containing more than one pointer-size member
(eg. shared_ptr), and there are architectures (notably x86) where an int
is considerably more thread-safe than this could be, because they have a
(architecture, not language) guarantee of coherence lacking in larger
values (or in multi-member structs regardless of size). (Granted,
portable code cannot assume pointer-size values are coherent, but often
a given architecture can be assumed.)

I don't recall where intrusive_ptr (the core of rope) falls on this
spectrum; it is using an atomic refcount but there's still the separate
operations of copying the pointer and updating the refcount. I think
it's safe if done in the correct order, however; but not otherwise.

> The grammar seems wrong here; 'I don't know if you've ever written an
> undo system that can do, undo, or redo any command you can think of, in
> less than 40 lines of code, but there one is."

It sounds correct to me; however it probably would be slightly better to
put "in less than 40 lines of code" in parentheses or dashes rather than
comma clauses.


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