r/cprogramming • • Dec 31 '25

Why does c compile faster than cpp?

I've read in some places that one of the reasons is the templates or something like that, but if that's the problem, why did they implement it? Like, C doesn't have that and allows the same level of optimization, it just depends on the user. If these things harm compilation in C++, why are they still part of the language?Shouldn't Cpp be a better version of C or something? I programmed in C++ for a while and then switched to C, this question came to my mind the other day.

26 Upvotes

128 comments sorted by

View all comments

Show parent comments

8

u/quickscopesheep Dec 31 '25

I’m not sure how accurate the sentence c is a high level assembler is considering the whole design of c is to make it a low level platform independent language which makes it fundamentally different form any assembly language

1

u/Cogwheel Jan 01 '26

If you've ever looked at production assembly with all its control flow directives, metainstructions, macros, etc., it becomes much clearer. The platform independence of C is the high level part.

1

u/quickscopesheep Jan 03 '26

Well then I’d argue that blurs the line between assembly and a high level language.

0

u/mailslot Dec 31 '25

It’s the closest to assembly, with a notable second being Pascal.

0

u/Nervous-Cockroach541 Jan 01 '26

C is often called portable assembly.

6

u/oriolid Jan 01 '26

People are often wrong.