why do header files even exist?

why do header files even exist?

Low Level

1 год назад

424,072 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@ChrisOchieng
@ChrisOchieng - 12.10.2024 19:25

Pascal: Interface, implementation 🤝

Ответить
@the_yugandharr
@the_yugandharr - 10.10.2024 13:38

thanks that was super informative!

Ответить
@oussamafarah2171
@oussamafarah2171 - 30.09.2024 06:31

go learn from Low Level or Learn japeniss
me in next Day : こんにちは世界

Ответить
@MarioRodriguez-bi9me
@MarioRodriguez-bi9me - 29.09.2024 07:04

I just think it's a lil too much, it needs to be broken down in a easier way to understand tbh

Ответить
@lilyscarlet2584
@lilyscarlet2584 - 28.09.2024 22:42

include just copy pastes so really its just a place to put symbol declarations that are shared across different compilation units. object files contain stubs inserted by the compiler and the linker resolves these stubs to some actual memory address at some point. either static or dynamic linking. also i always put extern to make the intent clear for readability even if its not needed.

extern int x;

this forward declares a global symbol x which will have some address that will be inserted later. its the same for functions. a function is just a memory address the decoration around it is just so the compiler knows what parameters and how to pass things on the stack and what the return is.

extern int Add(int, int);

the actual definition could be anywhere as long as its part of one of the files that the linker will pull in.

Ответить
@nalanpandi5932
@nalanpandi5932 - 28.09.2024 14:38

I like the quote "Everything is open source if you can read assembly" ❤

Ответить
@mintoo2cool
@mintoo2cool - 22.09.2024 04:05

can’t think this man enough for his absolutely no BS approach to systems computing/programming. he could have done 2 videos on zig or 3 videos on rust and just touched the surface of those .. for content. but he goes deep into basics of how real world systems works … not BS toy projects. thank you you kind man.

Ответить
@adoughnut12345
@adoughnut12345 - 17.09.2024 05:21

upvote for shirt

Ответить
@oglothenerd
@oglothenerd - 01.09.2024 05:44

"pee dot oh"

Ответить
@paidapps733
@paidapps733 - 29.08.2024 23:27

Also status codes and other consts.

Thus why.

Linkers need -l... regardless and documenting code can be done without headers but to reuse constants (and even common structs) nothing beats the header file.
In fact its the only way you can do it and where the term include is unambiguous (unlike when function prototypes are necessary)

Ответить
@khaledabouwalid1727
@khaledabouwalid1727 - 27.08.2024 22:40

shit this is hard

Ответить
@dehrk9024
@dehrk9024 - 26.08.2024 12:02

I love his chill vibes

Ответить
@james-m-8285
@james-m-8285 - 25.08.2024 14:32

Header files are definitely an unfortunate holdover of the early C era. I personally really like the C# way of doing it, where you just include by namespace, and if you need more decoupling you can use interfaces and pass / dependency inject an internal implementation class.

Ответить
@itzkxhu
@itzkxhu - 24.08.2024 16:59

my first guess is that there are some types that are called the same in different libraries?

Ответить
@jeanpierre3757
@jeanpierre3757 - 21.08.2024 12:07

This video is not a good explanation. Not at all. 2 stars out of ten. 😢

Ответить
@thepython10110
@thepython10110 - 15.08.2024 20:14

I genuinely don't think I've ever seen anyone using DWM with the bar on the bottom before. I know it's an option, but I've never seen it.
EDIT: Wow, that's obviously i3. Not sure how I made that mistake.

Ответить
@larryfulkerson4505
@larryfulkerson4505 - 12.08.2024 22:39

I read somewhere that humans eat more bananas than monkeys and I think it's probably true because I can't remember the last time I ate a monkey.

Ответить
@TrinitronX
@TrinitronX - 12.08.2024 11:17

If "liblowlevelmath .so" is closed source, then it should be pronounced: "lie • blow • level • math". This is because a closed source vendor can lie about what the code does, and that really blows.
If only perhaps C had been designed differently, all those header ".h" files would be redundant, and we'd live in a better world where Open Source software was the only type of software.

Ответить
@AG-ur1lj
@AG-ur1lj - 02.08.2024 17:36

Seems kind of dumb that you can even have mysterious, proprietary low-level libraries that can be released as products/part of your machine, etc.

Also, couldn’t any black box API like that be reverse-engineered? Obviously it would be non-trivial, but you would think with a little testing and inspecting the assembly…

Ответить
@oleksandrboiko9076
@oleksandrboiko9076 - 28.07.2024 16:09

The question is not «Why do they exist?», but «Why do they still exist and are necessary?», after so many years of the language's lifetime, when it could have been optimized millions of times by automatically generating and separating declaration and definition from one source file that is easy for a developer to write, read and maintain. And yet, we have to stick to this archaism even in our own programs we are not planning to distribute or close-source.

Ответить
@HalfAsleepSam
@HalfAsleepSam - 28.07.2024 04:00

"Everything is open source, if you can read assembly"
You're right.

Ответить
@trevoro.9731
@trevoro.9731 - 30.06.2024 19:35

They are not appropriate. They should have designed a better solution. That's right, why do header files even exist.

Ответить
@for-lack-of-a-better-name-j
@for-lack-of-a-better-name-j - 29.06.2024 09:43

Dude you have the best vids ever. Engaging AND technical.

Ответить
@gabrielsun104
@gabrielsun104 - 20.06.2024 02:21

AH, so "why not just make the function and its code in one file", "No, it's proprietary, they can use it but not see it", is header file.

Ответить
@infinitesimotel
@infinitesimotel - 19.06.2024 22:15

I love that t-shirt.

Ответить
@icycat9433
@icycat9433 - 19.06.2024 00:46

Somebody can explain me why using multi-module code require to create a header file, and then needs to include the header file in both?

Ответить
@ZipplyZane
@ZipplyZane - 17.06.2024 17:12

I was expecting this to answer why they decided to create these standard headers and not bake what is in them into the language. I assume it's a historical thing, possibly combined with just how low level C is intended to be. They didn't want to have code that is only added if it is used baked into the language itself.

Ответить
@sasikanthkola9925
@sasikanthkola9925 - 05.06.2024 21:27

I just started coding, into this video around 2 min, already subscribed...❤❤

Ответить
@buriedstpatrick2294
@buriedstpatrick2294 - 02.06.2024 05:39

Why do header files exist? Because C is an ancient language that can't infer definitions dynamically. I still don't at all get the point of these files.

Ответить
@peasant8246
@peasant8246 - 01.06.2024 14:40

Sorry, I was unable to pay attention to this video, as I kept getting distracted by his gorgeous hair.

Ответить
@warplanner8852
@warplanner8852 - 28.05.2024 15:30

For all you FNGs out there who want to understand this OTHERWISE FLAWLESS EXPLANATION, take a semester course learning how to write a compiler. The basic principle is very simple: the front end is the language parser that populates a set of parameters and values that are used by the back end to generate the assembler code to be absorbed by the assembler to generate machine code. If the parser cannot properly fill some of the tables you get compile time errors and if the assembler is missing data from the tables, you get load errors.

Ответить
@thisaintmyrealname1
@thisaintmyrealname1 - 25.05.2024 01:25

thank you, you not only explained me header files but also the point of using Makefiles towards the end ❤

Ответить
@bobtoad8601
@bobtoad8601 - 18.05.2024 13:05

The question is why modern compilers cannot generate those header files and still rely on manually write them

Ответить
@xyzxyz-y1b
@xyzxyz-y1b - 12.05.2024 17:34

meanwhile python proagrammers

Ответить
@meem2Greene-ju3cs
@meem2Greene-ju3cs - 11.05.2024 08:53

Ehrm can you use a question mark in a header file name? 🤓

Ответить
@noosetime9423
@noosetime9423 - 08.05.2024 01:08

ok but why not make the .c files compile into libraries that can be read as a header files by LSP/Compiler? Like it already needs to have most of the info, some function signatures aren't gonna break it zzz
and you could statically compile libraries or dynamically include them. headers are sometimes cool, but usually it's just more code for same thing.

Ответить
@OikPoinFive
@OikPoinFive - 29.04.2024 06:24

Huh?

Ответить
@rowdyriemer
@rowdyriemer - 28.04.2024 22:56

It's funny - when I write C++, I really like that C++ has headers. When I write C#, I really like that it doesn't have headers.

Ответить
@adityagautam4689
@adityagautam4689 - 28.04.2024 16:49

he is the only real human being to use solazized

Ответить
@triangleunderstander
@triangleunderstander - 21.04.2024 05:40

header files are beautiful, fuck the haters

Ответить
@xarisfil58
@xarisfil58 - 14.04.2024 13:34

"Returns a Client Star" instead of saying a pointer to a clients struct. This is how terror of pointers starts

Ответить
@EngineerNick
@EngineerNick - 13.04.2024 16:11

I am currently porting some stuff to rust that uses a headerfile that you are supposed to include multiple times, changing other state betweentimes so that you can declare multiple versions of a struct. This is pure insanity and should never have been posible.

Ответить
@johnmurray1889
@johnmurray1889 - 12.04.2024 21:06

Wow, this is such great information that I found a week after I needed to know it.

Ответить
@heanz
@heanz - 11.04.2024 18:41

love your channel

Ответить
@diegoj4382
@diegoj4382 - 11.04.2024 08:41

I expected to hear more about the Why and less about the How

Ответить
@markrosenthal9108
@markrosenthal9108 - 10.04.2024 12:32

For data that is not self-describing, you need a way to share the common structure across multiple source code files. It's also helpful for sharing common source processing directives. This concept originated before computers with "boilerplate" text and copy books and the term "copy book" was adopted by Amazing Grace for Cobol.

Ответить
@0xmmn
@0xmmn - 09.04.2024 01:33

I love your work man, although I know this info already but I'm enjoying watching you explaining it with this much practical details.

Ответить