Volatile variable

前端 未结 6 1528
梦谈多话
梦谈多话 2020-12-25 15:12

Where is a volatile variable stored in the program memory(in which section) ?

6条回答
  •  孤独总比滥情好
    2020-12-25 15:49

    volatile is a type qualifier not a storage class specifier, so it does not determine storage location at all; it affects the definition of a variable's type, not its storage.

    It simply forces the compiler to explicitly read a variable whose type is volatile from the variable's storage location (wherever that may be) rather than assuming that some previously read value in a register for example remains valid.

提交回复
热议问题