Комментарии:
Pascal: Interface, implementation 🤝
Ответитьthanks that was super informative!
Ответитьgo learn from Low Level or Learn japeniss
me in next Day : こんにちは世界
I just think it's a lil too much, it needs to be broken down in a easier way to understand tbh
Ответить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.
I like the quote "Everything is open source if you can read assembly" ❤
Ответить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.
Ответитьupvote for shirt
Ответить"pee dot oh"
Ответить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)
shit this is hard
ОтветитьI love his chill vibes
Ответить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.
Ответитьmy first guess is that there are some types that are called the same in different libraries?
ОтветитьThis video is not a good explanation. Not at all. 2 stars out of ten. 😢
Ответить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.
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.
Ответить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.
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…
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.
Ответить"Everything is open source, if you can read assembly"
You're right.
They are not appropriate. They should have designed a better solution. That's right, why do header files even exist.
ОтветитьDude you have the best vids ever. Engaging AND technical.
Ответить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.
ОтветитьI love that t-shirt.
Ответить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?
Ответить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.
ОтветитьI just started coding, into this video around 2 min, already subscribed...❤❤
Ответить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.
ОтветитьSorry, I was unable to pay attention to this video, as I kept getting distracted by his gorgeous hair.
Ответить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.
Ответитьthank you, you not only explained me header files but also the point of using Makefiles towards the end ❤
ОтветитьThe question is why modern compilers cannot generate those header files and still rely on manually write them
Ответитьmeanwhile python proagrammers
ОтветитьEhrm can you use a question mark in a header file name? 🤓
Ответить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.
Huh?
Ответить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.
Ответитьhe is the only real human being to use solazized
Ответитьheader files are beautiful, fuck the haters
Ответить"Returns a Client Star" instead of saying a pointer to a clients struct. This is how terror of pointers starts
Ответить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.
ОтветитьWow, this is such great information that I found a week after I needed to know it.
Ответитьlove your channel
ОтветитьI expected to hear more about the Why and less about the How
Ответить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.
ОтветитьI love your work man, although I know this info already but I'm enjoying watching you explaining it with this much practical details.
Ответить