I read a lot about the differences, benefits, and disadvantages, but if you have programmed anything with the two, please explain the benefits and disadvantages of both.
Edit: vs. D, if you are knowledgeable about all 3 and want to extend that much.
Edit 2: More importantly, I'm wanting to know if there are any reasons to use C over C++, and C++ over D.
In my opinion, instead of minimal speed differences, it all comes down to the question : do you want OOP? I know that you can some of it with C using structs, but meh. Also, you can always write your lower level code in C, then create an encapsulating C++ class for it, the beauty is that you can use both at the same time.
C++ is OOP, so, it's an higher level language than C. More your language is higher, less you have control on things... And more you're program will not be "optimized". Actually, the difference will be seen in things like OS kernel... As C++ is an extension of C, you can use both in your project, so, I'll say, use C when you really need big control on resources and output and use C++ when you want OOP. (N.B. C++ program that do the same thing than a C program will probably give a more complex ASM output. Less optimized) For memory management, file I/O, string manipulation, I tend to use C over C++. For other things, I use OOP.
It's like the big brother of C++. Same features of C++11 plus garbage collection, no need for header files, completely object-oriented, and many other features. Unfortunately, there aren't many good IDEs around, yet .
@CptSky : It will give a more complex ASM code only if you use C++ headers, but you can always use the C headers, also it`s a bit compiler dependent. Regarding file I/O, I did some tests with in the near past, turns out that fprintf() is waaaay faster than fstream& operator::<< in GCC (MinGW) 3.x.x, though in 4.x.x << wins hands down. So as compilers evolve, subjects of debate tend to change.
I think I'm going to force myself through hell and try a large scale project in C over the summer when I want to take a "break" from the source Korvacs and I are developing. I'm talking about using Notepad++, the GCC compiler, and creating my own makefiles. I've been spoonfed by VS for a long time. But please continue the discussion - I'm still interested, and this is an interesting thread.
@CptSky : It will give a more complex ASM code only if you use C++ headers, but you can always use the C headers, also it`s a bit compiler dependent. Regarding file I/O, I did some tests with in the near past, turns out that fprintf() is waaaay faster than fstream& operator::<< in GCC (MinGW) 3.x.x, though in 4.x.x << wins hands down. So as compilers evolve, subjects of debate tend to change.
Not only when you use C++ headers. Just the fact of using classes and objects will produce more complex ASM code as the code has to be structured with the objects and not only a few methods in the application.
As you said, optimization is compiler dependent... So, sometimes the same C code will be slower than the same C++ code. But, it won't remove the fact that being an higher language, C++ will be less optimized and more complex. In term of speed, memory management, etc. C++/CLI is an extension of C++ that add support of a garbage collector. The result is less optimized than a C++ application... You have less control on memory because a part is managed by the GC... For the output, it way more complex because it contains ASM and CIL bytecode.
It's like the big brother of C++. Same features of C++11 plus garbage collection, no need for header files, completely object-oriented, and many other features. Unfortunately, there aren't many good IDEs around, yet .