3 ms·
It was only ever a thing in the first place because, almost half a century ago, some people decided to write a one-pass compiler due to storage/memory limitatio
by colejohnson66 3y ago
It was only ever a thing in the first place because, almost half a century ago, some people decided to write a one-pass compiler due to storage/memory limitations. Even 40+ years ago, C was the only popular language that required them - to never address the issue is practically inexcusable.
- uecker 3y agoI personally like headers very much and do not understand the hate: They are super simple and efficient. They do not work well C++ though because it puts the implementation into the header for some reason.
- pjmlp 3y agoThe reason being the compiler needs to know the template code to be able to generate a specialization for it. ELF files based on the C type system can't provide such information on object files, and binary libraries. In the modules world it can read it from the symbol table on the BMI, like in any other module based language.
- uecker 3y agoNot sure what ELF and C type system has to do with this. C type information can be stored in ELF (as well as many other things). This is how a debugger can know the types. It is simply a language design flaw of C++ that class implementation (not just templates) ended up in the headers.