c++visual-c++warningsinline

What's the use of C4711 "function selected for inline expansion" Visual C++ warning?


According to MSDN Visual C++ can emit C4711 warning: function X selected for inline expansion if the compiler decides to inline a function that was not marked inline.

I don't see how this warning can be useful. Suppose I compile my code and see this warning. Now what? Why would I care?


Solution

  • It isn't on by default. You can turn it on if for some reason you'd like to know when functions are inlined. This can be relevant if, say, code size is at a severe premium, or you were expecting to jump into the function from outside the module, or you need the assembly to look a certain way. It can help track down code generation bugs as well.

    It's purely informational.