By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,067 Members | 1,818 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,067 IT Pros & Developers. It's quick & easy.

volatile keyword in c language

P: 1
what is the use of volatile keyword in c language
Aug 14 '07 #1
Share this Question
Share on Google+
2 Replies


Expert 10K+
P: 11,448
what is the use of volatile keyword in c language
This is what the C Standard has to say about it:

[#6] An object that has volatile-qualified type may be
modified in ways unknown to the implementation or have other
unknown side effects. Therefore any expression referring to
such an object shall be evaluated strictly according to the
rules of the abstract machine, as described in 5.1.2.3.
Furthermore, at every sequence point the value last stored
in the object shall agree with that prescribed by the
abstract machine, except as modified by the unknown factors
mentioned previously.105) What constitutes an access to an
object that has volatile-qualified type is implementation-
defined.
kind regards,

Jos
Aug 14 '07 #2

weaknessforcats
Expert Mod 5K+
P: 9,197
What JosAH is saying is that the compiler should not be making assumptions about the variable, like not creating an actuakl variable but using a processor register instead. volatile warns the compiler to be sure to create a variable.
Aug 14 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.