command to check inline function replacement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anchl
    New Member
    • Apr 2016
    • 1

    command to check inline function replacement

    #include<iostre am>
    using namespace std;
    inline int max(int a,int b);
    main()
    {
    cout<<max(10,20 )<<endl;
    }
    inline int max(int a,int b)
    {
    return a > b ? a : b ;
    }

    Is there any command by which we can see the call is replaced by body of function .
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    When you say inline, it is only a suggestion to the compiler. At compile time your inline function may, in fact, be inline. Or it may be a normal call. Plus other functions you did not specify as inline have become inline.

    The only control you have is to use volatile. When you do, you tell the compiler that you know stuff it doesn't and you require the function to be always a normal stacked call.

    The only peek that I know of is the translation unit fed to the compiler. This is your source code after the pre-processor has completed. This allows you to see if your macros are working.

    Comment

    Working...