1) Inline functions are specific to a class; #define is global.
2) Inline functions work on member variables (usually private); #define works on symbols.
3) Inline functions are parsed by the compiler whereas #define is expanded by the precompiler.
4) Inline functions are safer because they follow type conventions of functions; #define can be anything.
5) Inline functions can be used for debugging; #define cannot because once it’s expanded you don’t get a break point at run time.
6) Inline functions benefit from consistent argument treatment; #define is a wild beast in this.
Maybe other differences?
Fill in your details below or click an icon to log in:
You are commenting using your WordPress.com account. ( Log Out / Change )
You are commenting using your Twitter account. ( Log Out / Change )
You are commenting using your Facebook account. ( Log Out / Change )
You are commenting using your Google+ account. ( Log Out / Change )
Connecting to %s
Notify me of new comments via email.
Notify me of new posts via email.