PDA

View Full Version : C vs C++ Speed



golfinguy4
04-13-2002, 12:40 AM
Since both code is converted into machine code, how could one language be faster for the other? Wouldn't the two different statements that mean the same thing be translated into the same machine code?

golfinguy4
04-13-2002, 12:55 AM
Salem, must you always post the google searches? I already had searched the first page before I even asked. And there is no way I am going through the 60k pages.

shtarker
04-13-2002, 01:01 AM
I think the speed would depend on the compiler more than the language used.

golfinguy4
04-13-2002, 01:14 AM
Ya, that is what I was wondering about. I have heard the myth/fact that C is faster and I was just curious if it was true and how.

Shiro
04-13-2002, 03:20 AM
C++ programs can be as fast as C programs which perform "the same" operations or even faster. It depends also on your design, the speed of the functions in the libraries you use, your ability to write efficient code and your ability to design efficient algorithms. Since C++ usually requires object oriented thinking it is hard to compare it to C which requires procedural thinking.

The operations the C++ program performs are not always the same as the C program performs. It is possible in C++ to write C code and it is possible to write object oriented software in C, but usually you don't. So I think it's very hard to compare the languages.

I think you can't compare C and C++ as you can compare C and Pascal.

Fordy
04-13-2002, 04:00 AM
Originally posted by golfinguy4
Salem, must you always post the google searches? I already had searched the first page before I even asked. And there is no way I am going through the 60k pages.

The reason why he posts links like that is because this has been discussed so many damn times that its boring offering the same damn opinion.....

Is it harder to read old threads on this than to create new ones?