Re: volatile char
- From: "Lau Lei Cheong" <leu_lc@xxxxxxxxxxxx>
- Date: Tue, 5 Jul 2005 09:50:03 +0800
Er... Isn't it have any use in multithread programming?
Maybe it's my misunderstanding, but according to my understanding the
"volatile" keyword will turn off optimization to that particular variable,
so the code will always fetch the value from main memory, instead of using
the value located in register or whatever places. So sometimes I do use
"static volatile" variables as interprocess controls.
"David Lowndes" <davidl@xxxxxxxxxxxxxxx>
???????:snnhc1hgjcvh11gloocnaib891mbnhl4c9@xxxxxxxxxx
>> I saw a keyword 'volatile' in a embedded system code.
>>Does that will use in VC? and What is that mean?
>
> volatile means that the value of the variable can change without the
> compiler knowing about it. It's of little (no) use in normal Win32
> user mode programming since it's almost always only useful in
> memory-mapped I/O situations.
>
> Dave
> --
> MVP VC++ FAQ: http://www.mvps.org/vcfaq
.
- Follow-Ups:
- Re: volatile char
- From: Bo Persson
- Re: volatile char
- From: Igor Tandetnik
- Re: volatile char
- References:
- volatile char
- From: boki
- Re: volatile char
- From: David Lowndes
- volatile char
- Prev by Date: Re: FYI: Inserting "#undef UNICODE " at a beginning of a file is not always enough
- Next by Date: Re: volatile char
- Previous by thread: Re: volatile char
- Next by thread: Re: volatile char
- Index(es):
Relevant Pages
|