From: Seungbeom Kim on
itaj sherman wrote:
> On Dec 5, 6:17 am, peter koch larsen <peter.koch.lar...(a)gmail.com>
> wrote:
>>
>> void f(volatile bool b)
>
> btw, I hope I didn't miss something important: what is the point in
> 'b' being volatile?

My guess is that it is just meant to emphasize (to the human readers)
that you cannot determine the value of b statically, which would of
course hold even if volatile were not there.

I haven't seen volatile as a top-level qualifier (i.e. not through a
pointer or a reference), and I don't think it means anything significant.
Please correct me if I'm wrong.

--
Seungbeom Kim

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Frank Birbacher on
Hi!

Seungbeom Kim schrieb:
> I haven't seen volatile as a top-level qualifier (i.e. not through a
> pointer or a reference), and I don't think it means anything significant.
> Please correct me if I'm wrong.

It means the value may change outside the program flow in this function.

void changeBool(volatile bool& what) {
what = true;
}

void doVolatile(volatile bool param) {
boost::thread(bind(&changeBool, ref(param)));
if(param)
...
}

I usually see volatile for global variables or class members.

Frank

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]