◄ Wiki / Crypto
volatile
A C keyword that tells the compiler a variable's memory must really be touched and not optimized away.
Compilers aggressively remove work they think has no effect — including writing zeros to memory that's about to be discarded. Marking that memory volatile forbids the optimization, forcing the write to actually happen. In security code this matters when wiping secrets: without volatile the compiler may skip the wipe, leaving keys in memory, so sensitive buffers are wiped through volatile.