We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, when keyword volatile is used in the C programming...i have studied in one book that this volatile keyword is a directive to the compiler's optimizer that variables declared as volatile will not undergo any optimization by the compiler.......... My question is what type of optimizations the compiler is not allowed to be performed on that variable. i have been learning 8051 microcontroller(Atmel At89c51) C programming. Please little help will be very useful for my interviews.
thanks in advance........
The compiler must not assume that it knows the value of the variable and optimize away reloads, since a volatile variable may change value asynchronously.