C / C++ FAQs & Programming Resources - ProkutFAQ : MacroVsInline

HomePage Recent Changes Recently Commented Login/Register
Quick Links
Categories
Links
lirodaracv
What are the differences between macros and inline functions?

  • Macros are not compiler dependent, they are definite to be replaced in place of the macro call, but inline is just a request to the compiler compiler for placing the function inline, it may be ignored if it doesn't meet the compilers requirement for inlining.
  • Type checking is not done for macro calls, where as for inline functions, full type checking is done as for any other functions.
  • Macros can get evaluated more than once if its replaced with another macro constant, but this is not the case with inline functions.
  • The inline function arguments (such as i++) are evaluated before the call to function is made, but macro just replaces the argument as it is being given.

 Comments [Hide comments/form]
Page was generated in 0.0163 seconds