Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-02-17 04:33:06


Michael Glassford wrote:

> One potential problem that I am aware of is that it is possible for the
> m_generation counter (see barrier.cpp) to overflow on systems that
> detect overflow of integer addition instead of wrapping (I assume there
> are such systems though I've never used one). Is it worthwhile checking
> for this and forcing wrapping in code?

I think that barrier will work just fine with a binary flag, as opposed to
integer generation counter. In which case you can do

   flag = !flag;

or

    m_generation = (m_generation + 1) % 2;

Which would be simpler that checking for overflow on maximum integer value.
It's still interesting to know if processors which trap on overflow exists
nowdays...

- Volodya

   


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