Boost logo

Boost :

Subject: Re: [boost] [contract] the volatile issue
From: Nevin Liber (nevin_at_[hidden])
Date: 2011-10-01 15:43:25


On 1 October 2011 13:47, Lorenzo Caminiti <lorcaminiti_at_[hidden]> wrote:
> N1962 does not indicate that contracts for volatile members should be
> handled in any special way (in fact, volatile is not discussed at all
> in N1962).

In practical terms, I'm not sure I want checkable contracts for
volatile members.

volatile roughly means that if I need it for my program to work,
something outside of the normal flow of execution will happen to the
object.

Either it will have side effects when I access it, or its value can be
changed out from under me. Given those two situations, how do you
envision checkable contracts to work?

There is also the idea that Andrei Alexandrescu put forth in
<http://drdobbs.com/cpp/184403766> to use volatile member functions
for other purposes. Is that the kind of thing you envision applying
contracts to?

The uses I've seen of volatile on non-primitive types is almost always
a programming error. Do you have practical examples where this is not
the case?

-- 
 Nevin ":-)" Liber  <mailto:nevin_at_[hidden]>  (847) 691-1404

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