Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

inline functions [duplicate]

Tags:

c++

c

Possible Duplicate:
Benefits of inline functions in C++?

I have a confusion regarding the inline function.

People say inline functions saves CPU time by replacing the function with the original code, but that it increases the size of the code when compared to a normal function.

So the real question is if I keep on calling that inline function within a loop for 10 times, will the code size get increased.

Suppose the inline function size is 2 bytes, will it increase by 20 bytes?

Can anyone explain it to me?

like image 453
jack Avatar asked Dec 10 '22 07:12

jack


1 Answers

The same code will be executed 10 times. But still within a loop, so the code is not copied 10 times in a row. So size will not grow with the number of executions.

like image 61
Leif Avatar answered Dec 24 '22 19:12

Leif