The requirement for a function to be inline in C ++

what is the requirement for a function so that it can be executed inline in C ++? is there a case where a function cannot be inline? or can any function be built-in, and the programmer must decide how to determine the function based on runtime and compile-time considerations?

+3
source share
5 answers

What is the requirement for it to be able to be executed inline in C ++?

It must be defined in every place in which it is called (usually this is done by putting it in .h).

is there a case where a function cannot be inline?

, , , , .

, , , , ?

inline - , , (, , "" , , , , , ;-) - , , " ", " t - ..).

, register ( , ++ register, inline) - IOW, , ​​ inline .

(, " ", , , - , , -).

" " inline, inline ( option/flag , #define inline "" inline ). , . , , , , .

+3

, . , , , . , . , , , , , . , .

inline - , , .

+5

, inline ++? , ?

- , . , , "inline". : . , , .

, , , - ?

, inline, , , inline. (, MSVC __forceinline) - , inline.

+4

, , , - ?

, , , .

+1

built-in functions depend on the length of the code and complexity of the code ... :) The built-in function is just a request to the compiler ...

+1
source

Source: https://habr.com/ru/post/1758528/


All Articles