Thread: C and C++ compile speed

  1. #1
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688

    C and C++ compile speed

    Strange one, but when I use DevC++ on the rare ocassion, I have discovered somthing interesting about the compiler.

    If I write and compile a C++ program it compiles in the standard compile time.
    If I write a C program and ensure it compiles with a .c extension, the compiler
    compiles the C code in lightning quick speed, even faster than if was compiling
    C++ code with the .cpp extension.

    Did the creators of the MINGW compiler intend C programmers to use it in favor of C++? Why does it compile C code faster than C++ code?
    Double Helix STL

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Because C is easier to compile than C++ perhaps?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,743
    Like Salem said, C is easier to compile. C is a much simpler language that doesnt have to worry about classes, inheritance, templates, etc.
    My Website

    "Circular logic is good because it is."

  4. #4
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Ok thanks guys. I didnt think the answer was that simple.
    Double Helix STL

Popular pages Recent additions subscribe to a feed