Freigeben über


Retail debugging technique -- #pragma optimize

Retail debugging is one of those things that is both painful and necessary. To avoid repeating myself, I will just point to my old blog entry on this subject -- https://blogs.msdn.com/greggm/archive/2004/12/15/315673.aspx.

I was doing some retail debugging today, and realized that I forgot to mention one good technique for solving retail only bugs – disable optimizations for the interesting code. Lots of bugs go away when everything is compiled /Od, but often you can disable optimizations in a function or two without destroying your repro.

#pragma warning(push)

#pragma warning(disable:4748) // Disable warning about /GS being disabled due to optimizations being disabled

#pragma optimize("", off)

HRESULT MyClass::MyFunction()

{

...

}

#pragma optimize("", on)

#pragma warning(pop)

Comments

  • Anonymous
    August 07, 2007
    Introduction This FAQ can be used to narrow down the problems associated with debugging any type of solution