Search code examples
c++inline

When are functions inlined within the compilation process


In gcc, using

  • -E gives the preprocessed code;
  • -S, the assembly code;
  • -c, the code compiled, but not linked.

Is there anything close to a -I, that would allow me to see whether a function has been inlined or not, i.e., to see the code expanded, as though inline functions were preporcessed macros?

If not, should I get my way through the assembly code, or are the inline applications performed later?


Solution

  • I think examining the assembly code is the best (and pretty much the only) way to see what's been inlined.

    Bear in mind that, in certain circumstances, some inlining can take place at link time. See Can the linker inline functions?