English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

3 answers

A macro is not neccesarily defining a function. An inline function does, so you can use "return ". A macro would use assignments instead.

2007-01-24 23:06:14 · answer #1 · answered by BataV 3 · 0 0

Inline functions are similar to macros because they both are expanded at compile time, but the macros are expanded by the pre-processor, while inline functions are parsed by the compiler.
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.
Debugging macros is also difficult.
Macros are always expanded by pre-processor, whereas compiler may or may not replace the inline definitions. You cant force compiler to make a function inline. It is purely compiler based decision.

Here you find good answer : http://www.firmcodes.com/difference-macro-inline-c/

2015-02-13 13:45:41 · answer #2 · answered by viss 1 · 0 0

the preprocessor macro is a collection of statements which are commonly used in a C++ program and to use preprocessor macro we use # include<> in a program while inline function is a function which is defined in one line only.

2007-01-24 22:00:23 · answer #3 · answered by ajay p 2 · 0 1

fedest.com, questions and answers