Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

volatile keyword in C++

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

Accepted Solution

by:
AndyAinscow earned 150 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…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

824 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