3 ms·
I just freakin' hate .h files... Writing pretty much the same thing but twice and in two different places for every function. Why?!? I would love C++ if not for
by everyone 5y ago
I just freakin' hate .h files...
Writing pretty much the same thing but twice and in two different places for every function. Why?!?
I would love C++ if not for them.
- pjmlp 5y agoThen use modules, VC++ 20219 has the best support, GCC 11 has similar support, it is mostly clang that still had some catch-up to do.
- jart 5y agoOr use traditional C. The x86_64 System V ABI is well defined enough that I'm honestly not sure why we need prototypes. All we need is a compiler that authorizes us to use an ILP64 data model. Then we'll be able to write C the way it was intended to be written without the quadratic header complexity. C++ showed us where that path leads and I truly hope modules happen but it's about as likely as my hopes of restoring the good parts of K&R C.
- pjmlp 5y agoC was already a pre-historic language in 1992, why should I bother with it in 2021, unless I must do so for business reasons? It is the COBOL of systems programming languages and must be dealt exaclty on the same terms.
- efficax 5y agoFor modules in GCC you currently have to build the branch yourself. Not the best experience
- pjmlp 5y agoMissing out on GCC 11 release? https://gcc.gnu.org/gcc-11/changes.html https://gcc.gnu.org/gcc-11/changes.html > Modules, Requires -fmodules-ts and some aspects are incomplete. Refer to C++ 20 Status Naturally some C++20 features aren't still fully there, it isn't as if they aren't coming.
- kunos 5y agosadly no, modules won't solve this problem. Yes you can write your implementation in a single module but it'll behave as if you were writing them in a .h file. That means that changing a single number in a module will trigger a recompilation of all the dependent modules. At the end of the day you end up with slower compile times for small changes. I was hoping to finally be able to be done with header files but no.. another missed opportunity for C++. Perhaps future C++ compilers will be able to figure out if the external surface of a module has actually changed or not and make this possible.. but alas it doesn't seem to be the case in VS2019 at the moment.