is there any way to disable compiler optimisation for a specific line of code in Visual studio?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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 )
回答2:
You can use this optimize pragma to control this on a function basis