How to store a C++ variable in a register

后端 未结 8 2067
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-15 23:26

I would like some clarification regarding a point about the storage of register variables: Is there a way to ensure that if we have declared a register variable in our code,

8条回答
  •  有刺的猬
    2020-12-15 23:48

    Here you can use volatile register int i = 10 in C++ to ensure i to be stored in register. volatile keyword will not allow the compiler to optimize the variable i.

提交回复
热议问题