News for hackers. Stuff that matters.
Re:Goodbye C++, Hello C by everyone on Saturday June 26, 2021 @01:24AM (#27639341)
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.
Re:Goodbye C++, Hello C by pjmlp on Saturday June 26, 2021 @01:53AM (#27639497)
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.
Re:Goodbye C++, Hello C by kunos on Sunday June 27, 2021 @06:11AM (#27650211)
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.
Re:Goodbye C++, Hello C by efficax on Saturday June 26, 2021 @08:54AM (#27641431)
For modules in GCC you currently have to build the branch yourself. Not the best experience
Re:Goodbye C++, Hello C by pjmlp on Sunday June 27, 2021 @03:29AM (#27649421)
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.

Re:Goodbye C++, Hello C by jart on Saturday June 26, 2021 @05:34AM (#27640475)
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.
Re:Goodbye C++, Hello C by pjmlp on Sunday June 27, 2021 @03:30AM (#27649429)
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.