Click here to Skip to main content
15,912,400 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Yes. Pin
George_George28-Dec-07 3:53
George_George28-Dec-07 3:53 
GeneralRe: Yes. Pin
CPallini28-Dec-07 4:05
mveCPallini28-Dec-07 4:05 
GeneralRe: Yes. Pin
George_George28-Dec-07 18:18
George_George28-Dec-07 18:18 
GeneralRe: Yes. Pin
CPallini28-Dec-07 22:50
mveCPallini28-Dec-07 22:50 
GeneralRe: Yes. Pin
George_George28-Dec-07 23:08
George_George28-Dec-07 23:08 
GeneralRe: Yes. Pin
CPallini28-Dec-07 23:45
mveCPallini28-Dec-07 23:45 
GeneralRe: Yes. Pin
George_George29-Dec-07 0:00
George_George29-Dec-07 0:00 
GeneralRe: Yes. Pin
Maxwell Chen28-Dec-07 4:25
Maxwell Chen28-Dec-07 4:25 
George_George wrote:
1. In your experience, when do you use volatile?
2. If we share data between threads and we are already using synchronization approach like mutex, do we need to add additional volatile keyword?


I don't use volatile in real-world code.

I started coding C/C++ in 1998. Only in the first year when I'd read volatile keyword, I tested it in exercise code. Well, at that time I did not know what debug/release builds were. I did not see the difference. Later on in 1999, I learned some more things, so I tried to use it. At that time, the threading design of mine was so poor. Yes, volatile was used in my early code, for once or twice. Finally I realized that with proper design for synchronisation mechanism of threading, volatile is not necessary.


Maxwell Chen

GeneralRe: Yes. Pin
JudyL_MD28-Dec-07 12:21
JudyL_MD28-Dec-07 12:21 
GeneralRe: Yes. Pin
George_George28-Dec-07 18:17
George_George28-Dec-07 18:17 
GeneralRe: Yes. [modified] Pin
JudyL_MD28-Dec-07 20:01
JudyL_MD28-Dec-07 20:01 
GeneralRe: Yes. Pin
George_George28-Dec-07 23:01
George_George28-Dec-07 23:01 
GeneralRe: Yes. Pin
JudyL_MD29-Dec-07 4:40
JudyL_MD29-Dec-07 4:40 
GeneralRe: Yes. Pin
George_George29-Dec-07 19:39
George_George29-Dec-07 19:39 
GeneralRe: Yes. Pin
JudyL_MD30-Dec-07 4:37
JudyL_MD30-Dec-07 4:37 
GeneralRe: Yes. Pin
George_George31-Dec-07 4:01
George_George31-Dec-07 4:01 
GeneralRe: Yes. Pin
JudyL_MD31-Dec-07 4:30
JudyL_MD31-Dec-07 4:30 
GeneralRe: Yes. Pin
George_George31-Dec-07 5:17
George_George31-Dec-07 5:17 
GeneralRe: Yes. Pin
George_George28-Dec-07 18:19
George_George28-Dec-07 18:19 
GeneralRe: Yes. Pin
David Crow28-Dec-07 4:58
David Crow28-Dec-07 4:58 
GeneralRe: Yes. Pin
George_George28-Dec-07 18:17
George_George28-Dec-07 18:17 
GeneralRe: MSDN volatile sample Pin
peterchen28-Dec-07 2:47
peterchen28-Dec-07 2:47 
GeneralRe: MSDN volatile sample Pin
George_George28-Dec-07 3:20
George_George28-Dec-07 3:20 
GeneralRe: MSDN volatile sample [modified] Pin
peterchen28-Dec-07 4:21
peterchen28-Dec-07 4:21 
GeneralRe: MSDN volatile sample Pin
Maxwell Chen28-Dec-07 4:31
Maxwell Chen28-Dec-07 4:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.