Search code examples
c++visual-studioinlining

Allow inlining in specific headers in debug mode Visual Studio


Is it possible to have a build setting in which specific headers are allowed to be inlined in a debug build? I am using the signal/delegate pattern alot which I test in a separate project. I would like my main project not to show the signal/delegate parts of the callbacks in the call stack when I am hitting a breakpoint. Is it possible to allow inlining functions on a header only library, without optimizing the main project, or is there some other way to filter the calls to the header only library from the call stack interface.


Solution

  • you may try #pragma optimize :

    #pragma optimize( "g", {on | off} )
    

    This work on a function-by-function basis.

    see https://msdn.microsoft.com/en-us/en-en/library/chh3fb0k.aspx

    You will probably need to activate inlining in debug mode, opt-out by default and opt-in for specific functions.