Solved

volatile keyword in C++

Posted on 2010-11-29
3
552 Views
Last Modified: 2012-05-10
what is volatile keyword in C++ is meant for?
0
Comment
Question by:svsathwick
3 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 50 total points
ID: 34232640
From the help files:

Objects declared as volatile are not used in certain optimizations because their values can change at any time. The system always reads the current value of a volatile object at the point it is requested, even if a previous instruction asked for a value from the same object.

In other words - you can be certain the value in that variable is corrrect at the time of reading it (not using any cached value)
0
 
LVL 12

Expert Comment

by:enachemc
ID: 34232929
volatile variable: a variable whose value is read from its original address each time it's accessed because the value stored at the original address can be change by concurent threads
0
 

Author Closing Comment

by:svsathwick
ID: 34345907
lacks example
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question