Take the 2-minute tour ×

Before I knew that C was faster than C++ I was able to write some simple code where C executed faster than C++'s speed.

So my question is: please explain then reason behind this.

If this has already been explained elsewhere on this site or the internet, please share a link.

share|improve this question

closed as not a real question by Billy ONeal, ybungalobill, Nawaz, Prasoon Saurav, Trey Jackson Jan 16 '11 at 17:26


Please define faster and provide some context. –  John Percival Hackworth Jan 16 '11 at 17:22
This is not a real question –  Prasoon Saurav Jan 16 '11 at 17:25
Its hard to comment on hypothetical situations. Post the test code. –  Loki Astari Jan 16 '11 at 17:26

2 Answers 2

The reason behind this is your poor test.

share|improve this answer
While this maybe true. The actual reason is more likely because of the probable simplicity of the test. Please post the test code and let us see! –  MatiasFG Jan 16 '11 at 17:22
@MatiasFG, thanks for repeating what wilhelmtell just said. –  Moo-Juice Jan 16 '11 at 17:25

C is not faster than C++ because C++ is a superset of C.

Here it is!

share|improve this answer
C++ isn't a strict superset of C. Being a superset would imply that every valid C program would be a valid C++ program, and that isn't the case. –  Laurence Gonsalves Jan 16 '11 at 17:36
@Laurance I agree! I'll just say that C++ adds to some aspects of C. –  Secko Jan 16 '11 at 17:39
Also doesn't some stuff valid in both languages have slightly different meaning in c++? –  Roman A. Taycher Feb 7 '11 at 3:59
