Normally, when I write software to access a register, I will do
something like this:
*((volatile u32*) 0x00000022) = 5; (with some wrappers to make it
cleaner)
however, I noticed that in a recent codebase that my company aquired,
volatile
is not used:
*((u32*) 0x00000022) = 5;
Is this a proper way of coding? I was under the understanding that if
volatile is not used, the code could be optimized out. Is this
correct? What does
everyone else do?
something like this:
*((volatile u32*) 0x00000022) = 5; (with some wrappers to make it
cleaner)
however, I noticed that in a recent codebase that my company aquired,
volatile
is not used:
*((u32*) 0x00000022) = 5;
Is this a proper way of coding? I was under the understanding that if
volatile is not used, the code could be optimized out. Is this
correct? What does
everyone else do?
Comment