Hacker News new | past | comments | ask | show | jobs | submit login

Then 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.



sadly 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.


For modules in GCC you currently have to build the branch yourself. Not the best experience


Missing out on GCC 11 release?

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.


Or 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.


C 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.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: