Volatile unsigned * in C ++
Possible duplicate:
Unsigned keyword in C ++
I am currently looking into how to access memory mapped devices (specifically the Raspberry Pi GPIO) directly and in some example code . I see the following
// I/O access
volatile unsigned *gpio;
What confuses me is the type is undefined. Is this valid C ++, and if so, what does the above code declare?
Thank!
PS: I know about the Raspberry Pi StackExchange, but this question is related to C ++ syntax only.
source to share
An attribute unsigned
with no base type is just shorthand for unsigned int
.
volatile
is an indication to the compiler that this value can change in ways that the program does not expect. In other words, the compiler shouldn't try to do any caching or optimization by value, since it doesn't know how it will change.
source to share