Dennis Ritchie of the Bell Labs
designed the C,
a general purpose computer programming language in 1972 for use with UNIX, an
operating system of then. C is predominantly used for system software
programming, but is also very useful for creating general application software.
Some of the adjectives used to describe C are block structured, imperative
& procedural language.
C++(originally named "C with
Classes" and still known as the superstructure of C in computer circles)
was developed as an enhancement of C by Bjarne Stroustrup in 1983 at the Bell
Labs. Stroustrup, in 1979, started by adding classes, virtual functions, operator
overloading, multiple inheritance, templates, exception handling etc. The C++
programming language standard was ratified as ISO/IEC 14882:1998 in 1998 and
the current version is the 2003 version, ISO/IEC 14882:2003 which is infact the
corrected version of the C++ 1998. The "Library Technical Report 1",
released in 2005 gives details of extensions to the standard
library without being a part
of the standar version. A new version of the standard (informally known as
C++0x) is under development. C++ has been a highly successful commercial
programming language since 1990. Though C++ is royalty-free, its documentation
is not freely available.
Here are some differences between
C and C++
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
|
References:
0 komentar :
Posting Komentar