Header Issues: Guards, Name Mangling, and extern 'C'

preview_player
Показать описание
---

Header files often have things in them that confuse beginning programmers. This video explains two of them — ifdef guards and extern "C" blocks.



***

Welcome! I post videos that help you learn to program and become a more confident software developer. I cover beginner-to-advanced systems topics ranging from network programming, threads, processes, operating systems, embedded systems and others. My goal is to help you get under-the-hood and better understand how computers work and how you can use them to become stronger students and more capable professional developers.

About me: I'm a computer scientist, electrical engineer, researcher, and teacher. I specialize in embedded systems, mobile computing, sensor networks, and the Internet of Things. I teach systems and networking courses at Clemson University, where I also lead the PERSIST research lab.

More about me and what I do:

To Support the Channel:
+ like, subscribe, spread the word

Want me to review your code?

You can also find more info about code reviews here.
Рекомендации по теме
Комментарии
Автор

6:44
_Z prefixes all Itanium mangled symbols to make it abundantly clear that the symbol name is mangled, else certain names (global variables) can be impossible to tell if mangled or not.
7 is the string length of "getmean"
Capital P is short for pointer, i is short for int, d is short for double.

Minty_Meeo
Автор

In your videos every aspect of C programming looks so clear and straight forward - in my C code things just segfault and dump... :D

SteelHorseRider
Автор

Wow! It really makes me stand in awe to see how well you can explain stuff and cram this much of excellent content into one succinct and beautiful video.

Congratulations!! 👏🏻👏🏻

lean.drocalil
Автор

besides a college course on C++ i don't think i have used function overloading. I had assumed that both C and C++ both supported it. this is the problem with taking a C++ course with out a C course or a C++ course making the assumption that the student will only use c++ and never C. thank you i learned something new today

samplesandtests
Автор

I know it's not common, but I always indent #ifndef, #define, #endif etc. Makes the code a lot easier to read right away. I can't see why one should not indent these guards. Jacob, thank you for such great videos. :)

Автор

Two days ago I was trying to test my C code with Boost testing library, but I gave up without understanding the reason. Now everything makes sense :D Thanks

samvelabrahamyan
Автор

Millions and millions of thanks for such a beautiful explanation in such a short video. Never heard "Name Mangling" before.
Please keep up the good work👍👍

theshaswat
Автор

Wow thanks alot! Stumbled about an issue on a large mixed c/c++ project at work today where the name mangling causes some errors I couldn't explain in the first place. Then a colleague told me about the name mangling and this video came in really handy!

Microbert
Автор

Unbelievably useful and EASY TO UNDERSTAND.Bit respect, sir

ahmetelhaddadi
Автор

Your videos are so great! Thank you for your work!

renatac
Автор

Excellent delivery and a great topic for C, C++ and Objective-C compilation

johnjoyce
Автор

Thank you sir, please don't stop creating good contents like this

birukberhanubekele
Автор

5:57
a) The return value is NOT part of the function signature
b) "arguments" are not part of the function signature - parameters are (arguments are "instances" of parameters)

Being painfully careful about clear communication is key in CS, especially when teaching beginners

Mortuus
Автор

6:51 This is just a guess, but I believe the __Z17 in print_person_info and the __Z7 in getmean represent the length of the original function names 😁

whirvis
Автор

Thanks for this video Jacob, I understand now the used of header guards. 😊

joseraphaelmaglunsod
Автор

Wow! I read it a lot but never understand it until I found this video. Awesome. Thank you.

pramoth-dev
Автор

Well I think you are realy onto the best ways to teach programming teaching the real fundamentals you actually need to move on explaining purposes and showing why some parts necessary in a subtructive manner good job help spread this so needed teaching model!

mikelemon
Автор

Thank you very much, this is the best explanation i have seen, if you understand a concept you will never forget. Well explained. Thank you

coenraadmulder
Автор

Thanks for the information. Keep uploading new videos.

harishkantsoni
Автор

Awesome explanation! Thank you so much!

starcw