Force order of execution of C statements?

前端 未结 3 1664
-上瘾入骨i
-上瘾入骨i 2021-01-04 02:06

I have a problem with the MS C compiler reordering certain statements, critical in a multithreading context, at high levels of optimization. I want to know how to force ord

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-04 02:35

    I would use the volatile keyword. It will prevent the compiler from re-ordering the instructions. http://www.barrgroup.com/Embedded-Systems/How-To/C-Volatile-Keyword

提交回复
热议问题