How Compilation Works Internally In C And C++?

  Рет қаралды 53,965

CppNuts

CppNuts

Күн бұрын

JOIN ME
-----
KZbin 🎬 / @cppnuts
Patreon 🚀 / cppnuts
COMPLETE PLAYLIST
------------
C++ Tutorial For Beginners: • Introduction To C++
STL (Standard Template Library): • STL In C++
ThreadIng In C++: • Multithreading In C++
Data Structures: • Data Structure
Algorithms: • Binary Search
Design Patterns: • Factory Design Pattern...
Smart Pointers: • Smart Pointer In C++
C++14: • Digit Separator In C++
C++17: • std string_view in C++...
C++ All Type Casts: • static_cast In C++
INTERVIEW PLAYLIST
------------
C++ Interview Q&A: • Structural Padding & P...
C++ Interview Q&A For Experienced: • How delete[] Knows How...
Linked List Interview Questions: • Find Kth Node From Bac...
BST Interview Questions: • Search Element In Bina...
Array Interview Questions: • Reverse An Array
String Interview Questions: • Check String Is Palind...
Bit Manipulation Questions: • Find Set Bit In Intege...
Binary Tree Interview Question: • Invert Binary Tree
Sorting Algorithms: • Bubble Sort
C++ MCQ: • Video
C MCQ: • What printf returns af...
C Interview Questions: • Designated Initializat...
QUICK SHORT VIDEOS
-------------
C++ Short : • C++ Short Videos
C Short : • Shorts C Programming MCQ
In this video we'll learn about How Compilation Works Internally In C And C++, it is very common question in C and C++ programming interviews.
There are several steps your program goes through when it is being compiled and i have tried to cover almost all the steps in details.
#cpp #interviewquestions #programming #tutorial #coaching #beginners #computerscience #softwareengineering

Пікірлер: 108
@CppNuts
@CppNuts 5 жыл бұрын
Hi everyone, Don't forget to hit LIKE and SUBSCRIBE button for more videos like this!! And this will help me a-lot.
@niketzope3884
@niketzope3884 5 жыл бұрын
Sir, can I have your mail-id, Actually, I'm an embedded Engineer Fresher in need of guidance gone through your c++ videos while viewing this video you mentioned ready queue I want to get in-depth knowledge c++ programming with Kernel. Please reply
@CppNuts
@CppNuts 5 жыл бұрын
Happy to see you so interested in c++, but i am not from Embedded background so i don't have much info about your question. But try hard in google you will get the answer for your questions i am sure.
@greymind0072
@greymind0072 3 жыл бұрын
Exceptional , simply so lucid and effective way of sharing knowledge. This page deserved million views and like for the quality content it have. Thank you so much for all the help and tutorials
@CppNuts
@CppNuts 3 жыл бұрын
Thanks man..
@rickzhi5498
@rickzhi5498 Жыл бұрын
No problem
@subbumotepalli
@subbumotepalli 5 жыл бұрын
Y i was missed cppnuts these many days.luckly i found today.Thank you sir.Asome topics and explanation.
@CppNuts
@CppNuts 5 жыл бұрын
Thanks man, share with friends so that they can be benefited too.
@senthilandavanpalani7294
@senthilandavanpalani7294 5 жыл бұрын
Basic and Useful concise video.Thank you for this post. Compiler does not mean it only gives *.o files.But there are things happening underhood such as preprocessor, then proprocessor files are used by compiler and process it and gives assembler code.Then assembler code code was used by Assembler and after it processed it gives object files.Then object files and static libraries are used by linker and process then gives executable file.Then executable file and the dll,.so files are used by Loader to load into the OS. You guys are really helping a lot of C++ people including you.Expecting many more concepts.
@CppNuts
@CppNuts 5 жыл бұрын
I appreciation it.
@jitendrabaug6928
@jitendrabaug6928 5 жыл бұрын
It is so nice of you to create these videos. Thank you Very Much. One request .. Could you please explain the member functions(static/non-static) and where it is stored in memory model(code/Data/Stack/Heap) and how the call is performed ?
@sireeshajangam1561
@sireeshajangam1561 3 жыл бұрын
Wonderful explanation sir👍👍👍
@CppNuts
@CppNuts 3 жыл бұрын
Thanks man.
@faroquealjakaria3661
@faroquealjakaria3661 7 жыл бұрын
Thanks a lot! This really cleared some of my doubts. Good job.
@CppNuts
@CppNuts 7 жыл бұрын
Faroque AI Jakaria Hi.. Welcome Dude.. Keep Learning!!
@sauravgupta6166
@sauravgupta6166 3 жыл бұрын
g++ fileName.cpp --save-temps also worked on Windows! Thank you so much, I glad to know about your channel by one of my true friend.
@CppNuts
@CppNuts 3 жыл бұрын
Glad to help!
@programmingwithht
@programmingwithht 3 жыл бұрын
In windows We use g++ -o main.exe main.cpp --save-temps To get assembler file, preprocessor file and object file
@nemesisanims7401
@nemesisanims7401 4 жыл бұрын
Please add in depth videos, i rellly love this, and you should start teaching OS with c++, you will definetly rock
@CppNuts
@CppNuts 4 жыл бұрын
Sure.. man thanks..
@bostonlights2749
@bostonlights2749 4 жыл бұрын
wow man.... this is so cool looking under the hood to see all the assembly level code written.
@CppNuts
@CppNuts 4 жыл бұрын
Thanks dude..
@ashrafashraf4404
@ashrafashraf4404 4 жыл бұрын
Great teaching boss I Love The Video
@CppNuts
@CppNuts 4 жыл бұрын
Many many thanks
@raisshaikh2105
@raisshaikh2105 7 жыл бұрын
It would be good if you can upload video about how dynamic and static libraries are loaded during program execution?
@CppNuts
@CppNuts 7 жыл бұрын
+Rais Shaikh Hi.. Nice question, wait for next week. :)
@tapanjeetroy8266
@tapanjeetroy8266 3 жыл бұрын
Thanks for this awesome explanation
@CppNuts
@CppNuts 3 жыл бұрын
Welcome
@abhishektandon2312
@abhishektandon2312 3 жыл бұрын
Does Linker create .exe file in case of ubuntu , because .exe are only compatible with windows OS
@mayaicdi
@mayaicdi 2 жыл бұрын
Love your videos! Keep up the good work!
@CppNuts
@CppNuts 2 жыл бұрын
Thanks
@R_BNK
@R_BNK 7 жыл бұрын
Nice work bro ... Your videos are very helpful ...Keep it up
@CppNuts
@CppNuts 7 жыл бұрын
+Rohit Benake hi.. i would :D thanks dude..
@deepaksingh-mk2nu
@deepaksingh-mk2nu 7 жыл бұрын
Hi you doing great job Regularly i am watching your video i have an doubt Q1. Why derived class pointer can not point to base class pointer? Q2. If we are not creating the copy constructor compiler will provide the copy constructor But if we write our own the copy constructor then how the compiler know no need to create the copy constructor? Thanks
@CppNuts
@CppNuts 7 жыл бұрын
Ans 1: i will create a video for this, so stay tuned for your answer. Ans 2: copy constructor syntax is fixed so when you are compiling code then compiler checks for copy constructor syntax in your class and if that is available then compiler doesn't provide its own.
@deepaksingh-mk2nu
@deepaksingh-mk2nu 7 жыл бұрын
many many thanks to you :)
@luckbychance3179
@luckbychance3179 6 жыл бұрын
Why derived class pointer can not point to base class pointer?: Because a base class pointer do not have any idea about the content of Base class so when pointing a derived class pointer to a base class will cause an error. You can do the upcasting to perform such operations.
@shivakaramadi9444
@shivakaramadi9444 5 жыл бұрын
your videos are amazingly informative and very helpful. Do you know how do I capture pre-processor output?
@CppNuts
@CppNuts 5 жыл бұрын
In linux there is an option u can provide while compiling which is save-temps which should give u that, i dont know in windows. And google about save-temps u will get it.
@arunselvasuresh6048
@arunselvasuresh6048 4 жыл бұрын
Please explain about static and dynamic libs
@R_BNK
@R_BNK 7 жыл бұрын
Very Good Explanation ...👍
@CppNuts
@CppNuts 7 жыл бұрын
+Rohit Benake hi.. thank you so much.. :D
@mockingbird3809
@mockingbird3809 4 жыл бұрын
great explanation!
@CppNuts
@CppNuts 4 жыл бұрын
Glad it was helpful!
@techytechwithgunjan9175
@techytechwithgunjan9175 6 жыл бұрын
perfect explanation
@CppNuts
@CppNuts 6 жыл бұрын
Thanks man...
@dreamskycreations1902
@dreamskycreations1902 4 жыл бұрын
Nicely explained bro👍
@CppNuts
@CppNuts 4 жыл бұрын
Thanks man..
@testingDhippiuh
@testingDhippiuh 4 жыл бұрын
Thanks for sharing
@CppNuts
@CppNuts 4 жыл бұрын
My pleasure
@m.vineeth9724
@m.vineeth9724 3 жыл бұрын
Awesome explanation 🔥
@CppNuts
@CppNuts 3 жыл бұрын
Glad you liked it
@kunalprasad1678
@kunalprasad1678 4 жыл бұрын
Why adding function to structure or class doesn't increase its size but variable increases its size...? Can you please explain.
@spicytuna08
@spicytuna08 6 жыл бұрын
u r like a classical pianist virtuoso except you use keyboard. pretty impressive.
@CppNuts
@CppNuts 6 жыл бұрын
Thanks for such a nice comment!! :D
@aftabalam5521
@aftabalam5521 7 жыл бұрын
When we say new state of operating system where is our code(hard disk or ram? Like u said that loader loads the executable to ready state of OS?
@CppNuts
@CppNuts 7 жыл бұрын
When you double click any application, then the application will get converted into pages and will be stored in RAM. This is new state. Page creation is very big topic search it. (if you already don't know)
@TheStrelok7
@TheStrelok7 7 жыл бұрын
Parsing the Template in preprocess stage or in compile stage?
@CppNuts
@CppNuts 7 жыл бұрын
+Iron Core hi.. it happens at compile time.
@TheStrelok7
@TheStrelok7 7 жыл бұрын
can you prove that cuz i'm little some confused! one last thing, someone said: if C++ templates are implemented by preprocessing, there will be issues with dynamic linking(using .dll). how could this happen?
@CppNuts
@CppNuts 7 жыл бұрын
+Iron Core Read second answer. stackoverflow.com/questions/6264249/how-does-the-compilation-linking-process-work
@deepaksingh-mk2nu
@deepaksingh-mk2nu 7 жыл бұрын
Hi man .... What i am saying it might be more than expectation ..... Can you make some video for real time work and how industry is working on the c++ and how it works .....too many underprivileged people can make benefit from it No one is there like you that's why i am requesting.... Again Many many thanks to you for your great job ...
@sonulohani
@sonulohani 7 жыл бұрын
good one bro... u deserve more subs
@CppNuts
@CppNuts 7 жыл бұрын
+Sonu Lohani hi.. thanks for your appreciation, and i will have one day for sure.. ;)
@azadalishah2966
@azadalishah2966 6 жыл бұрын
Can u pls explain how .dll and .so is linked/loaded while running executable? Thanks in advance:)
@kunalprasad6898
@kunalprasad6898 4 жыл бұрын
I have a doubt.If Dll is linked with .exe then why our code throws error while building program if we dont mentioned path of dll.According to your concept it should throw error when i will try to run not build? Please let me know if I am wrong.
@aby_yadav
@aby_yadav Жыл бұрын
Good question. Dynamic libraries (dll or .so) are also looked by linker for resolving symbols. You can run ldd to see from where it is linking.
@sivaramakrishnachitithoti1428
@sivaramakrishnachitithoti1428 5 жыл бұрын
Thanks
@CppNuts
@CppNuts 5 жыл бұрын
Welcome..
@vvpChannel3112
@vvpChannel3112 5 жыл бұрын
i dont understand .in the diagram u said .asm file generates first and assembler converts .asm to .obj file...and demo u showed that obj file generates before .asm file
@CppNuts
@CppNuts 5 жыл бұрын
.asm come first then .obj.
@alliswell6587
@alliswell6587 5 жыл бұрын
will you please explain the compilation steps in windows
@CppNuts
@CppNuts 5 жыл бұрын
It is similar, there is no difference in compilation when it comes to OS.
@nemesisanims7401
@nemesisanims7401 4 жыл бұрын
just a bit of suggestion, please combine your knowledge with Operating Systems, it will really boost up your channel
@CppNuts
@CppNuts 4 жыл бұрын
Sure.. i will try..
@sethupathynarayanaswamy8192
@sethupathynarayanaswamy8192 5 жыл бұрын
Good Job :-)
@CppNuts
@CppNuts 5 жыл бұрын
Thanks man!!
@jotirlingswami9357
@jotirlingswami9357 3 жыл бұрын
The comment is replaced with empty new line after preprocessor in *.ii file.
@TechSafarWithSunil
@TechSafarWithSunil 7 жыл бұрын
If my program compile successfully then how it fails at linking time?
@CppNuts
@CppNuts 7 жыл бұрын
sunil singh Hi.. It can not compile successfully if not linked properly, for example linking means it can see whether the definition of every function i have used is available if not than linking error. [Preprocessor -> Compiler -> Linker] ==>> all these phases combined together is called Compiler. Don't get confuse with 2nd step being named as compiler i don't know why they kept it so confusing (everything all together is called compiler and 2nd step is also called compiler). If you are still confuse please wait for my another video where i will take an example and will explain all the intermediate steps with that.
@TechSafarWithSunil
@TechSafarWithSunil 7 жыл бұрын
Thank you sir
@jotirlingswami9357
@jotirlingswami9357 5 жыл бұрын
#include void foo() { #define MY_NAME "Alex" } int main() { std::cout
@CppNuts
@CppNuts 5 жыл бұрын
#define will be available after defining it, and in second case you are trying to use before defining.
@jotirlingswami9357
@jotirlingswami9357 5 жыл бұрын
@@CppNuts So at the time of compilation it read the value of MY_NAME and replace at where ever it find MY_NAME. It has only file and global scope right?
@CppNuts
@CppNuts 5 жыл бұрын
@@jotirlingswami9357 #define can be inside functions also, and it has nothing to do with compilation, as it will be processed during preprocessing time. But your 2nd program is not working because MY_NAME is not replaced with preprocessor because when preprocessor would have reached to line: std::cout
@jotirlingswami9357
@jotirlingswami9357 3 жыл бұрын
@@CppNuts Very good explanation Thank you sir
@aseemsameer7281
@aseemsameer7281 3 жыл бұрын
Cool
@sonulohani
@sonulohani 7 жыл бұрын
are you a student?
@CppNuts
@CppNuts 7 жыл бұрын
+Sonu Lohani hi.. No dude i work, and fallen in love to make videos and want to make a huge channel for C & C++.
@sonulohani
@sonulohani 7 жыл бұрын
CppNuts if you dont mind can i ask where do you work
@CppNuts
@CppNuts 7 жыл бұрын
+Sonu Lohani hi.. Dude thanks for your interest, i work in Bangalore. Company i can't tell because i want to keep it secret until i announce this channel in my friend circle. :D
@sonulohani
@sonulohani 7 жыл бұрын
Thanks for sharing the details... Its ok to keep it as secret. I also work in Bangalore as C++ dev.
@CppNuts
@CppNuts 7 жыл бұрын
+Sonu Lohani hi.. great.. can you share the company if it's ok with you. ;)
@oldold6636
@oldold6636 7 жыл бұрын
ok?ok?ok?
@CppNuts
@CppNuts 7 жыл бұрын
yess one of my bad habits.. :)
@ArunDhyani
@ArunDhyani 6 жыл бұрын
CppNuts usually you get this habit by talking to south Indians 😂 . But hey if you could tell us more about shared objects and how do they work . It would be really helpful.
@CppNuts
@CppNuts 6 жыл бұрын
Yes i am in Bangalore :), and i didn't get your question about shared objects plz explain more..?
@ArunDhyani
@ArunDhyani 6 жыл бұрын
Hi , I am also a c++ developer . First you get .o and then linker generates .lo . I am clear to these steps . But how does .so are generated and I think I read somewhere that they are dynamic linked (how does that work? ). If you could make a separate video for explaining shared objects it would be really helpful.
@CppNuts
@CppNuts 6 жыл бұрын
Ok, that requires another video will try some day..
@mallika1427
@mallika1427 3 жыл бұрын
Thanks
@CppNuts
@CppNuts 3 жыл бұрын
Thanks
How delete[] Knows How Much  To Deallocate In C++?
12:24
CppNuts
Рет қаралды 71 М.
Difference Between Reference And Pointers In C++
10:02
CppNuts
Рет қаралды 65 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
IL'HAN - Qalqam | Official Music Video
03:17
Ilhan Ihsanov
Рет қаралды 700 М.
Bit Fields In C & C++
20:36
CppNuts
Рет қаралды 22 М.
Arenas, strings and Scuffed Templates in C
12:28
VoxelRifts
Рет қаралды 108 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 857 М.
How the C++ Compiler Works
17:55
The Cherno
Рет қаралды 844 М.
C++ Super Optimization: 1000X Faster
15:33
Dave's Garage
Рет қаралды 337 М.
reinterpret_cast In C++
14:33
CppNuts
Рет қаралды 45 М.
How do computers read code?
12:01
Frame of Essence
Рет қаралды 3,2 МЛН
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Рет қаралды 347 М.
you will never ask about pointers again after watching this video
8:03
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН