Remix.run Logo
Panzerschrek 3 days ago

Why do people do such wired projects? Why not just using C++ instead of pure C?

dfawcus 3 days ago | parent | next [-]

Maybe because one is working on a legacy C program, and for various reasons adding C++ to said program is too risky or expensive?

brightprogramer 3 days ago | parent | prev | next [-]

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.

Panzerschrek 3 days ago | parent [-]

Ok, it's fine, if you just wanted to experiment with macros. This seems to be a legit reason to use pure C.

brightprogramer 3 days ago | parent | prev [-]

It also compilers way faster than C++ code if that interests you :-)

Panzerschrek 3 days ago | parent [-]

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.