News for hackers. Stuff that matters.
Re:Yet Another TypeSafe and Generic Programming Candidate for C by Panzerschrek on Wednesday September 10, 2025 @02:03AM (#45193888)
Why do people do such wired projects? Why not just using C++ instead of pure C?
Re:Yet Another TypeSafe and Generic Programming Candidate for C by dfawcus on Wednesday September 10, 2025 @03:41AM (#45194493)
Maybe because one is working on a legacy C program, and for various reasons adding C++ to said program is too risky or expensive?
Re:Yet Another TypeSafe and Generic Programming Candidate for C by brightprogramer on Wednesday September 10, 2025 @02:44AM (#45194129)
Because I just don't like it as much and I wanted to see how much farther can we go by just using macro tricks.
Re:Yet Another TypeSafe and Generic Programming Candidate for C by Panzerschrek on Wednesday September 10, 2025 @03:11AM (#45194282)
Ok, it's fine, if you just wanted to experiment with macros. This seems to be a legit reason to use pure C.
Re:Yet Another TypeSafe and Generic Programming Candidate for C by brightprogramer on Wednesday September 10, 2025 @03:08AM (#45194256)
It also compilers way faster than C++ code if that interests you :-)
Re:Yet Another TypeSafe and Generic Programming Candidate for C by Panzerschrek on Wednesday September 10, 2025 @03:14AM (#45194305)
I agree, C++ code compilation is generally slower compared to C. But the compiler itself isn't particularity slower (under the hood it's the same compiler), but compiling C++ code with a lot of templates is slow.

For me personally compilation slowdown is just a price, which I am ready to pay for more language features, including better abstractions and type safety.