Is it possible to force a function not to be inlined?

In Visual Studio 2010, __declspec(noinline) tells the compiler to never inline a particular member function, for instance:

class X {
     __declspec(noinline) int member_func() {
          return 0; 
     }
};

edit: Additionally, when compiling with /clr, functions with security attributes never get inlined (again, this is specific to VS 2010).

I don’t think it will prove at all useful at debugging, though.

Leave a Comment