Комментарии:
idk man
ОтветитьOk, so the usp of H files is to... document close sourced binaries? It feels like documentation and housekeeping, more than something we actually need. Sqlite distributes it's clib as a big fat C file... I don't get the point
ОтветитьExcellent explanation - thank you.
But (of course there's a but)...
you could improve it by avoiding something. It's something I see all the time, and it kinda drives me nuts because of how small a thing it is for how significant an impact it has on a video. Although not true here, I've seen some comp sci videos rendered basically worthless to me, not worth the bother, because of this one little thing.
When you name things using "code" and "client" and similar comp sci vocab & jargon words, it massively increases the cognitive load to follow what you're doing. I understand that when you're making the presentation, it makes perfect logical sense... here's the part that's code, here's the part that's client, and so forth. But the consequence is that the viewer has to constantly be mentally disentangling the language syntax from your naming choices... and that's a distracting burden when your identifiers are camouflaged as language syntax. If instead of "code" and "client", you'd used - I dunno, "pizza" and "lizard" - then your presentation would've been much easier to follow. (Metaphors can work nicely with this - Lasagna objects living in BakingPan allocations, or whatever. Metaphors are best, but simply not camouflaging the names is the main thing.)
One thing is that all the code in the header files does get compiled in with the rest of the code which is why really big header files, or source code files with lots of headers take a while to compile since there's a lot of hidden code being analyzed by the compiler.
Ответитьwhich linux distro u use and which ide do u use? thx! <3
ОтветитьMy god I hate stack overflow, you just summed up something I spent hours looking for in 10 minutes. Holy. Fuck.
ОтветитьInstead of "why do header files even exist" you explained how header files work, but the question from the title of the video still stands.
You may have noticed that header files are almost exclusive to C/C++ languages, other languages somehow don't need them. So why do header files even exist?
For those wondering, header files exist mostly for historical reasons. Since memory was very limited back when C was developed, compilers couldn't afford to keep track of modules themselves, so it became the job of the programmer. Modern compilers are far less hardware restricted, which allows them to favor developer experience over efficiency.
Awesome channel, fills in a lot of my knowledge gaps efforlesly!
ОтветитьAwesome explanation! Thanks!
ОтветитьNow I'm, curious, since other languages don't have header files (like Java), how can they expose shared library (if that even exist for a language) APIs without also exposing the implementation details?
Ответитьlove your shirt
ОтветитьWhat is `catg l`?
ОтветитьHeader files smth like a interface, where you declare the function and parameter
ОтветитьWill you consider doing a video about dll files? Back in the days, when I was a little pirate, i used to see them a lot. Still have no complete understanding of them.
ОтветитьHeader fights create a prototype declaration of the interface to a full actual function.
Only at link time you'd need the code for the function. Ultimately the whole compilation process will be faster, and gives you a full correctness check before linking.
C should generate those on command.
ОтветитьBtw, for linker paths in e.g. proprietary programs, patchelf from the NixOS project exists. It lets you change paths to libraries in standard Linux ELF files, which they have to use as that distro doesn't use /usr/lib.
ОтветитьI think header file is also the way to make function implementation private/hidden from the end user
ОтветитьExplain about import vs include
Ответить