the key point here is that in modern C++ *inline* is just a hint to the compiler to emit inline code and elide the call/return overhead of a standard procedure call. In the "old" days - over 20 years ago - when the compiler and processors were simpler, and the programmer knew more than the compiler(!) *inline* was a direction, not a hint. Now, with fiercely efficient optimization phases and insanely complicated processors with (as you pointed out) multiple levels of instruction and data cache, instruction pipelining and branch prediction, it's no longer possible to out-do the compiler and processor by imagining that high-level language constructs directly equate to certain instructions at the processor level. It can be even more confusing on non-Intel architectures like register-based RISC processors. Bottom line: C++ always tries to generate the most efficient code on any platform, short of hand-coded assembler which isn't even really possible anymore in the modern era, and would take ten times longer to write even if you tried.
Best depth explaination for real programmers. Who is interested in how my code is excuting and need performance. Obviously if someone is coding in C++, performance really matter to his project
I was looking for a really deep explanation. This is exactly what I was looking for. Thank you so much! I would really appreciate deep explanation of concepts like this one :-)
interviewer asked me about this what is inline function?? Thanx too u so that i was able to give answer. (Keep posting interview questions for experienced)
Amazing video. Detail explanation of every point about inline function. You left no question to ask but I'm going ask one ;) What project you are working on which takes 20 to 30 minutes to compile on a server ?
Thanks for you interest dude. We are developing EDA Tool for FPGA's. This is like building compiler but not c/c++ compiler. It takes verilog code files as input(verilog is used to create circuit using programs) and then this tool compile the verilog code and create a virtual circuit. Then we insert that virtual circuit inside FPGA and then it starts acting like a real circuit. I hope you will understand this comment. Actually this is Electronics side and if you are from CS background you may find it hard to understand it. Let me know if you understood :)
Very thank you for the OS explanation. I am not able to “Join” in your youtube channel, are memberships still there buddy ? Let me know, if you are running on any other platform. Thanks.
No I don't run any memberships program now, it's just the donation box, so for example, someone get selected in some interview or really happy with my teaching and they are capable then can donate.
linine means replacing the function call with the function body: So compiler take care of the passing argument means assembly code manages that inside??
its not assembly code, its the compiler which changes the code means take care of passing the argument, and then what ever the code is changed by compiler that code is further converted into assembly code and everything goes after that.
inline function does not have arguments,as there is no more function call happening,whereever formal arguments are used will be replaced by actual args. example inline void add(int x) printf("%d",x); int main(){ int x=10 add(x); } will become int main(){ int x=10; printf("%d",x) ; }
the key point here is that in modern C++ *inline* is just a hint to the compiler to emit inline code and elide the call/return overhead of a standard procedure call. In the "old" days - over 20 years ago - when the compiler and processors were simpler, and the programmer knew more than the compiler(!) *inline* was a direction, not a hint. Now, with fiercely efficient optimization phases and insanely complicated processors with (as you pointed out) multiple levels of instruction and data cache, instruction pipelining and branch prediction, it's no longer possible to out-do the compiler and processor by imagining that high-level language constructs directly equate to certain instructions at the processor level. It can be even more confusing on non-Intel architectures like register-based RISC processors. Bottom line: C++ always tries to generate the most efficient code on any platform, short of hand-coded assembler which isn't even really possible anymore in the modern era, and would take ten times longer to write even if you tried.
Thanks for writing detailed comment on the topic, it will help so many people. Great!!
Best depth explaination for real programmers. Who is interested in how my code is excuting and need performance. Obviously if someone is coding in C++, performance really matter to his project
we love you and its 2023 ..keep posting
I was looking for a really deep explanation. This is exactly what I was looking for. Thank you so much! I would really appreciate deep explanation of concepts like this one :-)
Glad it was helpful!
interviewer asked me about this what is inline function??
Thanx too u so that i was able to give answer. (Keep posting interview questions for experienced)
Sure man!!
Happy learning..
nice video,11:30 i got the idea and i hit like but and just subscribed. keep on making awsome videos
Awesome lecture
But can we can't use loop under inline function right??
your work is fantastic...thanks for such a nice playlist...
Ek number 👌👌👌.... You got a new subscriber..
Thanks..
Amazing video. Detail explanation of every point about inline function. You left no question to ask but I'm going ask one ;)
What project you are working on which takes 20 to 30 minutes to compile on a server ?
Thanks for you interest dude.
We are developing EDA Tool for FPGA's. This is like building compiler but not c/c++ compiler. It takes verilog code files as input(verilog is used to create circuit using programs) and then this tool compile the verilog code and create a virtual circuit. Then we insert that virtual circuit inside FPGA and then it starts acting like a real circuit.
I hope you will understand this comment. Actually this is Electronics side and if you are from CS background you may find it hard to understand it. Let me know if you understood :)
A very good explanation. Thank you man.
Welcome Radu.
What is the use of static inline ?
Is it preferred over macros? If yes, why?
Nice explanation.
thank you so much bro nicely explained!
Glad it helped
You are a great teacher.
Thanks man..
Yeah ...absolutely perfect explanation
Thanks
Amazing explanation bro.
Thanks man!!
Very thank you for the OS explanation. I am not able to “Join” in your youtube channel, are memberships still there buddy ?
Let me know, if you are running on any other platform. Thanks.
No I don't run any memberships program now, it's just the donation box, so for example, someone get selected in some interview or really happy with my teaching and they are capable then can donate.
Hi.. inline is also present in C, but you are saying it’s only present in Cpp. Please explain
linine means replacing the function call with the function body: So compiler take care of the passing argument means assembly code manages that inside??
its not assembly code, its the compiler which changes the code means take care of passing the argument, and then what ever the code is changed by compiler that code is further converted into assembly code and everything goes after that.
inline function does not have arguments,as there is no more function call happening,whereever formal arguments are used will be replaced by actual args.
example
inline void add(int x)
printf("%d",x);
int main(){
int x=10
add(x);
}
will become
int main(){
int x=10;
printf("%d",x) ;
}
have you covered any topics on C++17. if yes, please provide the link.Thanks.
No i haven't.
I feel enlightened.
Thanks for the comment!!
Thank you
Welcome Dude..
Where is the value of string?
The value of string is in function call , "Hi CppNuts"
super ..!!
Thanks man.. :)
Nice effort but stop saying "OK?" after every 2 sentence. It keeps breaking the process of learning and its annoying.
I will try my best
Boring lecture.