有没有办法禁用编译器优化一个特定的代码行? [英] is there any way to disable compiler optimisation for a specific line of code?
本文介绍了有没有办法禁用编译器优化一个特定的代码行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以禁用Visual Studio中特定代码行的编译器优化。
解决方案
p>
只有在使用优化pragma :
#pragma optimize([optimization-list],{on | off})
优化pragma必须在函数外出现
并生效at
第一个函数定义在
pragma后面。
参数打开或关闭
中指定的选项。
用法:
#pragma optimize(,off)
。
。
。
#pragma optimize(,on)
is there any way to disable compiler optimisation for a specific line of code in Visual studio?
解决方案
No.
Only on a function-by-function basis using the optimize pragma:
#pragma optimize( "[optimization-list]", {on | off} )
The optimize pragma must appear outside a function and takes effect at the first function defined after the pragma is seen. The on and off arguments turn options specified in the optimization-list on or off.
usage:
#pragma optimize( "", off )
.
.
.
#pragma optimize( "", on )
这篇关于有没有办法禁用编译器优化一个特定的代码行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文