By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,035 Members | 1,543 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,035 IT Pros & Developers. It's quick & easy.

command to check inline function replacement

P: 1
#include<iostream>
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 .
Apr 1 '16 #1
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,197
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.
Apr 2 '16 #2

Post your reply

Sign in to post your reply or Sign up for a free account.