I am currently reading the PostgreSql code. Here is an excerpt from the buffer manager:
static void WaitIO(volatile BufferDesc *buf);
static bool StartBufferIO(volatile BufferDesc *buf, bool forInput);
static void TerminateBufferIO(volatile BufferDesc *buf, bool clear_dirty,
I know the volatile keyword is usually used for device drivers and in embedded systems. There is an explanation of the keyword.
When the keyword volatile is used in the type definition it is giving an indication to the compiler on how it should handle the variable. Primarily it is telling the compiler that the value of the variable may change at any time as a result of actions external to the program or current line of execution. (Source)
So why are certain function arguments declared as volatile? I don't expect that DMA changes the pointer location. So what happens here?
void func(int volatile arg);- ideasman42