cpp/basics/volatile #62
Replies: 1 comment
-
如果编译器发现某个变量在函数中没有被修改,它可能会将其值缓存起来,避免重复访问内存。volatile 告诉编译器,该变量可能在程序的其他地方(如硬件中断、另一个线程等)发生变化,因此它不能缓存这个变量的值,每次访问时都必须从内存中读取最新的值。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
cpp/basics/volatile
编程指北: 计算机系统学习指南, 操作系统, 计算机网络, C++, Java, 算法, 数据结构
https://csguide.cn/cpp/basics/volatile.html
Beta Was this translation helpful? Give feedback.
All reactions