In VC ++, which means the # pragma equivalent of the / O 2 compiler option (optimization for speed)

According to msdn ,

/ O2 (maximum speed)

equivalently

/ Og / oi / ot / oy / ob2 / gs / gf / gr

and according to msdn , the next pragma

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

uses the same letters in its "optimization list" as the / O compiler option. Available letters for pragma are:

  • g . Turn on global optimizations.
  • p - improves floating point consistency.
  • s or t . Specify short or fast sequences of machine code.
  • y . Create frame pointers in the program stack.

, , /O2?

+3
2

:

  • /Og
  • /Oi .
  • /Ot ( ) .
  • /Oy .
  • /Ob2 , __inline, ,

/G , g t, #pragma intrinsic ( 2), #pragma auto_inline ( 5) , , #pragma inline_depth.

+2

, .

#pragma optimize ( "gty", off)

, /O 2 ,

#pragma optimize ( "gty", on)

: " ", /O 2 /Og/Ot/Oy.

/G, "".

0

Source: https://habr.com/ru/post/1766251/


All Articles