Thread: C vs C++ Speed

  1. #1
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138

    C vs C++ Speed

    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?

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    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.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    363
    I think the speed would depend on the compiler more than the language used.
    If you own a piece of land and there is an volcano on it and it ruins a
    nearby town, do you have to pay for the property damage?

  4. #4
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    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.

  5. #5
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    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.

  6. #6
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    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?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I am very new . . . :(
    By Eternalglory47 in forum C++ Programming
    Replies: 6
    Last Post: 09-05-2008, 11:29 AM
  2. Flight Simulator Wind Speed!!
    By Dilmerv in forum C++ Programming
    Replies: 6
    Last Post: 03-20-2006, 12:40 AM
  3. Replies: 6
    Last Post: 01-08-2006, 02:49 PM
  4. increased net speed
    By PING in forum A Brief History of Cprogramming.com
    Replies: 20
    Last Post: 03-29-2005, 07:05 AM
  5. Questions on Speed of Execution
    By wavering in forum C Programming
    Replies: 22
    Last Post: 01-20-2002, 02:04 PM