by markisus · 2y ago · 0 comments
I’ll just throw in my own pet peeves here.
The existence of .h files is still a big problem. I’m not aware of another language (besides c of course) that basically forces you to type the same letters twice in slightly different ways in order to expose a public api.
I also don’t understand why there’s still no way to print an enum value.
However there is some progress. I think std::span fixes the issue with the vector of const vs const vector. The Eigen library gives a (not perfect, but very convenient) matrix type. And I think I heard something about modules?
https://internals.rust-lang.org/t/interface-only-crate-type/...
C or C++ don't specify or require .h files. The languages don't even specify any file extension.
What C and C++ specify is the concepts of declaration and definition, and require only one definition across all translation units. Thus it's customary to simply have a single source for declarations to ensure they all stay consistent in spite of their usages, and those declarations are used once by wrapping them in include guards.