Why is volatile needed in C?

前端 未结 18 2515
攒了一身酷
攒了一身酷 2020-11-22 04:07

Why is volatile needed in C? What is it used for? What will it do?

18条回答
  •  我寻月下人不归
    2020-11-22 04:32

    Volatile is also useful, when you want to force the compiler not to optimize a specific code sequence (e.g. for writing a micro-benchmark).

提交回复
热议问题