|
| ||||||||||
| Tags: c language, keyword, modifier, variable, volatile |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| C : Volatile Modifier
|
|
#2
| ||||
| ||||
| C : Volatile Modifier
Hi, The Volatile Modifier means it is a directive to the compiler's optimizer. The operations involving Volatile Modifier should not be optimized in certain ways. It is worth to having use of the Volatile Modifier in two special cases. In the first case, It involves memory-mapped hardware means a device like a graphics adapter as if it is part of the computer's memory that appears to the computer's hardware and In the second case, It involves shared memory means that memory that is being used by more than two programs simultaneously running. |
|
#3
| ||||
| ||||
| C Program : Volatile Modifier
I suggest you to carefully go through the following lines of code that help you to know about the Volatile Modifier more easily : tim_t tim_add(volatile const struct timr *t, int b) { int m; int y; tim_t then; y = 0; then = t->value; for (m = 0; m < 1000; m++) { y = y + b; } return t->value - then; } |
|
#4
| ||||
| ||||
| Volatile Modifier
When the value of the variable can change unexpectedly that time variable can be declared as Volatile. basically, Only three types of variables can change: 1. Global variables accessed by multiple tasks within a multi-threaded application 2. Memory-mapped peripheral registers 3. Global variables modified by an interrupt service routine |
|
#5
| ||||
| ||||
| Volatile Modifier : C
Note that you can not be allowed to use volatile modifier on any time. The following are the data types with those you can use Volatile Modifier : 1. An enum type with an enum base type of the following: uint, sbyte, sshort, byte, short, int. 2. byte, sbyte, ushort, short, uint, int, float, char, bool. 3. Any pointer type in a unsafe context. 4. Any reference type. Example of Volatile Modifier : public volatile int age; |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "C : Volatile Modifier" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to change the modifier key which is not working on other keyboard | Ravana | Hardware Peripherals | 5 | 29-10-2010 01:53 AM |
| Specifications of UNIX User Password Modifier | Abigail101 | Windows Software | 5 | 06-02-2010 01:11 AM |
| Difference between Access Specifier and Modifier in Java | Sarfaraj Khan | Software Development | 5 | 19-01-2010 01:06 PM |
| Information about Win32/BaiduSobar the Browser Modifier | Juan-Carlos | Networking & Security | 5 | 12-12-2009 11:06 PM |