fl42v@lemmy.ml to Programmer Humor@programming.dev · 7 months agoYou can certainly change it. But should you?lemmy.mlimagemessage-square20fedilinkarrow-up10arrow-down10
arrow-up10arrow-down1imageYou can certainly change it. But should you?lemmy.mlfl42v@lemmy.ml to Programmer Humor@programming.dev · 7 months agomessage-square20fedilink
minus-squareOmega_Haxors@lemmy.mllinkfedilinkEnglisharrow-up0·edit-27 months agoContext is very interesting: https://stackoverflow.com/questions/4592762/difference-between-const-const-volatile Const flags to the code that you cannot change the value, and volatile flags to the compiler that it’s not safe to change the value.
minus-squareblackstrat@lemmy.fwgx.uklinkfedilinkarrow-up1·7 months agoVolatile means that the value should be read each time its accessed. It can’t be cached in a register or the read be otherwise assumed and optimized away or the instructions around its access be reordered.
Context is very interesting: https://stackoverflow.com/questions/4592762/difference-between-const-const-volatile
Const flags to the code that you cannot change the value, and volatile flags to the compiler that it’s not safe to change the value.
Volatile means that the value should be read each time its accessed. It can’t be cached in a register or the read be otherwise assumed and optimized away or the instructions around its access be reordered.