| C
| C++
|
Typing Discipline | Static, Weak | Static, Strong, Unsafe, Nominative |
Paradigms | Imperative (procedural) systems implementation language | Multi-paradigm, Object-Oriented, Generic, Procedural, Functional, Meta |
Designed by | Dennis Ritchie | Bjarne Stroustrup |
Influenced | awk, csh, C++, C#, Objective-C, BitC, D, Concurrent C, Java,JavaScript, Limbo, Perl, PHP | Ada 95, C#, Java, PHP, D, Aikido |
Influenced by | B (BCPL,CPL), ALGOL 68, Assembly | C, Simula, Ada 83, ALGOL 68, CLU, ML |
Major Implementations | GCC, MSVC, Borland C, Watcom C | GNU Compiler Collection, Microsoft Visual C++, Borland C++ Builder, Intel C++ Compiler, LLVM/Clang |
Appeared in | 1972 | 1985 |
Garbage Collection | Manual; allows better management of memory. | No GC available on the C++ standard library (STD). However, STD provides efficient and deterministic ways to manage resource such as object ownership and reference counting. |
Speed | C applications are faster to compile and execute than C++ applications | +-5% when compared with C if you know how to make a good use of C++. The performance of C++ and C programs can often be equal, since compilers for both languages are mature. |
Usual filename extensions | .c | .cc, .cpp, .cxx, .h, .hh, .hpp |
Programming-include | #include | #include |
Platforms | Almost anything on the planet; requires recompile | Almost anything, including OS-based and non OS-based platforms |
Programming-String type | No native string type; often declared as an array of characters | Array, std::string |
OOP (Object Oriented Programming) | Not built in; freedom to setup structures to act like objects. Lacks the ability to declare encapsulation. | Built in; size and memory layout of objects is deterministic. Virtual function calls can be done without vtable via CRTP. |
Classes | Uses structures instead, and hence bestows more liberty to use internal design elements | class and struct |
Programming-input /output | scanf for input;printf for output | iostream, fstream (std::cin, std::cout) |
Language Type | Procedural Oriented Language | Multi-Paradigm Object Oriented Language |
Developed by | Dennis Ritchie & Bell Labs | Bjarne Stroustrup |
Execution Flow | Top to Bottom | Top to Bottom |
Object-oriented | Not natively | Yes |
Generic Programming | No | Yes |
Procedural Programming | Yes | Yes |
Functional Programming | Yes | Partial |
Metaprogramming | No | Yes |
Reflection | No | No |
code | Compiled to native binary executable files | Compiled to native binary executable files |
Inline comments delimiter | // | // |
Block comments delimiter | /* and */ | /* and */ |
Statement terminators | ; | ; |
Multidimensional arrays supported | Yes | Yes |
Arrays dynamically sized | No | No |
Platform | Any that has a compiler | Any that has a compiler |