Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-05-23 13:18:10

--- In boost_at_y..., Iain.Hanson_at_u... wrote:
> Hi,
> It looks to me as though atomic_t should be templatedised on
> type. This would have the advantage of shrinking its memory
> to those member fuctions used.

I don't follow you here. Templatizing on the value type is not going
to shrink the "memory footprint" in any way (which foot print do you
mean, any way, data size or code size?).
> What behavior would you want of a counter once it reached the
> value for the value type. Should it wrap or latch?

A valid question, but I'm not sure it's one that should be answered.
In other words, I think it should result in undefined behavior.
> Which additional operations do you need on a counter?
> counters can have an arbitary value added or subtracted in
addition to
> inc and dec, but it does not normally make sense to negate or
> otherwise perform bitwise operations on a counter?

The operations provided now are the "standard" set of atomic
operations usually found on hardware architectures that provide
atomic operations. Addition (as opposed to inc and dec), negation,
bitwise operations, et al, generally serve no real purpose and
inclusion of any of these operations will eliminate the performance
optimizations possible on many platforms that support the presented
atomic operations.
Bill Kempf

Boost list run by bdawes at, gregod at, cpdaniel at, john at