首页 > 编程语言 > 详细

C++ Release编译时如何对某段代码不进行优化

时间:2018-08-23 17:26:43      阅读:294      评论:0      收藏:0      [点我收藏+]

optimize
#pragma optimize( "[optimization-list]", {on | off} )

Feature Only in Professional and Enterprise Edition    Code optimization is supported only in Visual C++ Professional and Enterprise Editions. For more information, see Visual C++ Editions.

Specifies optimizations to be performed on a function-by-function basis. 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.

The optimization-list can be zero or more of the parameters shown in Table 2.2.

Table 2.2   Parameters of the optimize Pragma

Parameter(s) Type of optimization 
a Assume no aliasing. 
g Enable global optimizations. 
p Improve floating-point consistency. 
s or t Specify short or fast sequences of machine code. 
w Assume no aliasing across function calls. 
y Generate frame pointers on the program stack. 


These are the same letters used with the /O compiler options. For example,

#pragma optimize( "atp", on )

Using the optimize pragma with the empty string (" ") is a special form of the directive. It either turns off all optimizations or restores them to their original (or default) settings.

#pragma optimize( "", off )
.
.
.
#pragma optimize( "", on ) 

C++ Release编译时如何对某段代码不进行优化

原文:https://www.cnblogs.com/kuangke/p/9525054.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!