0

Does inline functions really increase the execution time in c++?

I have read about when i shouldnt use inline functions in stackoverflow before, and it was saying that "if you think inline functions will make your code faster, dont use them ". My question is that inline functions are really faster than normal functions?

4th Feb 2021, 4:36 AM
Yunus Temurlenk
Yunus Temurlenk - avatar
3 Antworten
+ 2
Modern C++ compilers are smart enough to decide when to grant a request for making a function inline. An inline specifier is our request to the compiler, but whether or not the request is granted, is all up to the compiler. More about this in following links: http://www.cplusplus.com/articles/2LywvCM9/ https://www.tutorialspoint.com/cplusplus/cpp_inline_functions.htm
4th Feb 2021, 5:04 AM
Ipang
+ 2
Ipang so you mean even i dont declare a function inline compiler can make it inline? Also even i make inline compiler may not make it inline? I dont think this is right
4th Feb 2021, 5:08 AM
Yunus Temurlenk
Yunus Temurlenk - avatar
+ 2
For a comprehensive explanation, please refer to the attached links 👍
4th Feb 2021, 5:13 AM
Ipang