add my commend into the content
- Inline functions follow all the protocols of type safety enforced on normal functions.
- more safe then the macro, especially, for the type defination.
- for the type check, macro is checked by prepocessor, and inline functions is checked by compilar.
- Inline functions are specified using the same syntax as any other function except that they include the inline keyword in the function declaration.
- only difference is keyword “inline”
- Expressions passed as arguments to inline functions are evaluated once. In some cases, expressions passed as arguments to macros can be evaluated more than once.
- more variable for arguments
- There is no risk if called multiple times. But there is risk in macros which can be dangerous when the argument is an expression.
- functions can include multiple lines of code without trailing backlashes.
- functions have thier own scope for variables and they can return a value.
- debuging
Reference
[1] http://msdn.microsoft.com/en-us/library/bf6bf4cf.aspx
[2] http://www.thegeekstuff.com/2013/04/c-macros-inline-functions/
No comments:
Post a Comment