How can I verify whether a function is expanded inline in a C++ program?
My Compiler is Emscripten but an answer for g++
probably works.
Ideally, a code that runs differently when in inline mode (although it should not have any side effects).
How can I verify whether a function is expanded inline in a C++ program?
My Compiler is Emscripten but an answer for g++
probably works.
Ideally, a code that runs differently when in inline mode (although it should not have any side effects).
You can enable the -Winline
warning which prints a warning when a function marked inline
wasn't inlined.
See the documentation.
As an alternative, you can mark the function always_inline
which will trigger an error if it wasn't inlined. See the documentation.