Inline Function In C++

  Рет қаралды 30,728

CppNuts

CppNuts

Күн бұрын

Пікірлер: 53
@treyquattro
@treyquattro 6 жыл бұрын
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.
@CppNuts
@CppNuts 6 жыл бұрын
Thanks for writing detailed comment on the topic, it will help so many people. Great!!
@suryanshdey4773
@suryanshdey4773 Жыл бұрын
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
@mockingbird3809
@mockingbird3809 4 жыл бұрын
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 :-)
@CppNuts
@CppNuts 4 жыл бұрын
Glad it was helpful!
@baba-ti2gb
@baba-ti2gb 5 жыл бұрын
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)
@CppNuts
@CppNuts 5 жыл бұрын
Sure man!! Happy learning..
@pratimpal2679
@pratimpal2679 6 жыл бұрын
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 ?
@CppNuts
@CppNuts 6 жыл бұрын
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 :)
@shashikantchauhan8777
@shashikantchauhan8777 Жыл бұрын
we love you and its 2023 ..keep posting
@pussiestroker
@pussiestroker 4 жыл бұрын
sir, thank you for going through actual example clearly explaining how it improves locality of referencs
@janamthapa7249
@janamthapa7249 Жыл бұрын
Awesome lecture But can we can't use loop under inline function right??
@saitheja8080
@saitheja8080 9 ай бұрын
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.
@CppNuts
@CppNuts 9 ай бұрын
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.
@mrx-qi8th
@mrx-qi8th 3 жыл бұрын
nice video,11:30 i got the idea and i hit like but and just subscribed. keep on making awsome videos
@formovies7997
@formovies7997 4 жыл бұрын
your work is fantastic...thanks for such a nice playlist...
@Vineeth_Shankar
@Vineeth_Shankar 3 жыл бұрын
What is the use of static inline ? Is it preferred over macros? If yes, why?
@scutursula7536
@scutursula7536 5 жыл бұрын
A very good explanation. Thank you man.
@CppNuts
@CppNuts 5 жыл бұрын
Welcome Radu.
@vivekvaibhavraj3060
@vivekvaibhavraj3060 3 жыл бұрын
Nice explanation.
@jotirlingswami9357
@jotirlingswami9357 5 жыл бұрын
linine means replacing the function call with the function body: So compiler take care of the passing argument means assembly code manages that inside??
@CppNuts
@CppNuts 5 жыл бұрын
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.
@satishsuman3346
@satishsuman3346 4 жыл бұрын
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) ; }
@shirishashetty3967
@shirishashetty3967 3 жыл бұрын
Yeah ...absolutely perfect explanation
@CppNuts
@CppNuts 3 жыл бұрын
Thanks
@ramilachoudhary418
@ramilachoudhary418 5 жыл бұрын
Ek number 👌👌👌.... You got a new subscriber..
@CppNuts
@CppNuts 5 жыл бұрын
Thanks..
@sumitsuman641
@sumitsuman641 2 жыл бұрын
Hi.. inline is also present in C, but you are saying it’s only present in Cpp. Please explain
@zc7504
@zc7504 3 жыл бұрын
thank you so much bro nicely explained!
@CppNuts
@CppNuts 3 жыл бұрын
Glad it helped
@AyushSingh-lo4qo
@AyushSingh-lo4qo 3 жыл бұрын
You are a great teacher.
@CppNuts
@CppNuts 3 жыл бұрын
Thanks man..
@shilpaaggarwal5008
@shilpaaggarwal5008 3 жыл бұрын
have you covered any topics on C++17. if yes, please provide the link.Thanks.
@CppNuts
@CppNuts 3 жыл бұрын
No i haven't.
@avinash1347
@avinash1347 4 жыл бұрын
Amazing explanation bro.
@CppNuts
@CppNuts 4 жыл бұрын
Thanks man!!
@yograjmandloi9020
@yograjmandloi9020 5 жыл бұрын
I feel enlightened.
@CppNuts
@CppNuts 5 жыл бұрын
Thanks for the comment!!
@yabastacode7719
@yabastacode7719 6 жыл бұрын
Thank you
@CppNuts
@CppNuts 6 жыл бұрын
Welcome Dude..
@Jam-jf2nu
@Jam-jf2nu 5 жыл бұрын
Where is the value of string?
@scutursula7536
@scutursula7536 5 жыл бұрын
The value of string is in function call , "Hi CppNuts"
@ashutoshmore2546
@ashutoshmore2546 6 жыл бұрын
super ..!!
@CppNuts
@CppNuts 6 жыл бұрын
Thanks man.. :)
@bulentgercek
@bulentgercek 3 жыл бұрын
Nice effort but stop saying "OK?" after every 2 sentence. It keeps breaking the process of learning and its annoying.
@CppNuts
@CppNuts 3 жыл бұрын
I will try my best
@rumanshunath4688
@rumanshunath4688 3 жыл бұрын
Boring lecture.
@pussiestroker
@pussiestroker 4 жыл бұрын
sir, someone on stackoverflow mentioned that thd misuse of inline functions may suffer slowdowns. can you explain how?
Virtual Function In C++
15:08
CppNuts
Рет қаралды 35 М.
Сюрприз для Златы на день рождения
00:10
Victoria Portfolio
Рет қаралды 1,3 МЛН
1 сквиш тебе или 2 другому? 😌 #шортс #виола
00:36
Running With Bigger And Bigger Lunchlys
00:18
MrBeast
Рет қаралды 135 МЛН
Bit Fields In C & C++
20:36
CppNuts
Рет қаралды 22 М.
Inline Functions & Default Parameters in C++ Programming
13:31
Simple Snippets
Рет қаралды 110 М.
Friend Function | Friend Class In C++
16:26
CppNuts
Рет қаралды 27 М.
Advanced Topics: Function Inlining
6:49
CoffeeBeforeArch
Рет қаралды 6 М.
lvalues and rvalues in C++
14:13
The Cherno
Рет қаралды 318 М.
Why Isn't Functional Programming the Norm? - Richard Feldman
46:09
Static Data Member And Static Member Function In C++
17:19
CppNuts
Рет қаралды 52 М.
Reference Data Member In C++
13:58
CppNuts
Рет қаралды 10 М.