News for hackers. Stuff that matters.
Re:I stopped everything and started writing C again by naasking on Wednesday March 12, 2025 @04:57PM (#43347597)
> So I don’t know which good parts of C++ they kept.

comptime is a better version of C++ templates.

Re:I stopped everything and started writing C again by jandrewrogers on Wednesday March 12, 2025 @10:50PM (#43349953)
I really wish that were true but it isn’t. Modern C++ templates/constexpr are much more powerful and expressive than any Zig comptime equivalent.

The power and expressiveness of the C++ compile-time capabilities are the one thing I strongly miss when using other languages. The amount of safety and conciseness those features enable makes not having them feel like a giant step backward. Honestly, if another systems language had something of similar capability I’d consider switching.

Re:I stopped everything and started writing C again by bcrosby95 on Thursday March 13, 2025 @12:44AM (#43350471)
If it looks anything like what I read in "Modern C++ Design" 20+ years ago then I'll pass. That book made me realize the language wasn't for me anymore.
Re:I stopped everything and started writing C again by jandrewrogers on Thursday March 13, 2025 @01:18AM (#43350591)
It looks nothing like C++ decades ago, it is effectively a completely different language. I found C++ unusable before C++11, and even C++11 feels archaic these days. Idiomatic C++20 and later is almost a decent language.
Re:I stopped everything and started writing C again by bcrosby95 on Thursday March 13, 2025 @05:18PM (#43357323)
"Modern C++ Design" was the first book that highlighted template metaprogramming and showed you ways to use it as a Turing complete programming language in itself. Even a decade+ after it was printed my friend said it was recommended reading for employees within Google so I gave him mine - but I'm not sure about these days.

Talking about how much you can do with C++ templates made me think of that.

Re:I stopped everything and started writing C again by asyx on Friday March 14, 2025 @03:36PM (#43366380)
It’s not like that anymore.
Re:I stopped everything and started writing C again by koe123 on Thursday March 13, 2025 @06:32AM (#43351922)
I have written a lot of Zig comptime code and ended up finding the opposite. In C++ I find I have to bend over backward to get what I want done, often resulting in insane compile times. I've used metaprogramming libraries like Boost Hana before to have some more ergonomics, but even that I would consider inferior to comptime.

Out of curiosity, do you happen to have any examples of what you describe, where C++ is more powerful and expressive than Zig?