0
Inline function faster than execution due to it being considered as macro ?
Hi I think macros and inline function are not same. as far as I know, macros are replaced in code as it is during preprocessing stage... this is done before actual code compilation starts.. where as inline function are treated by complilation phase. preprocessor don't do anything for inline function. inline function are faster in execution( compared to normal function) due to overhead saved by removal of -function call -pushing of function parameters on stack is above true...? there is a quiz and it suggests that inline function are faster due to it being considered as macro... but this should be false instead of correct answer being displayed as true.. correct me if my understanding is not true.
3 Antworten
+ 1
Sure!
The most important thing to remember is that inline functions are macros, but not all macros are inline functions. Using an inline function means that the compiler will treat that as a macro and run it as such. It is my understanding that inline functions are not faster because they are considered macros, but because there is no overhead for the function call and pushing the parameters on the stack. I think the part about them being considered macros is just to trip people up on the question, but that's just my view on it.
0
🌛DT🌜 seems you have created this quiz...
Eli (I accept all challenges!) , FYI ...you can also share your views if you wish... you are a good c++ challenger