C++ versus C
Will “C” disappear? – No!
C++ Development Environments are usually quite large.
Object-oriented programs that use complex class hierarchies
can compile to large executable modules that do not run as efficiently as their
C language procedural counterparts. “C” is often better for device drivers and
embedded applications.
Take Note:
- C++
keywords can cause a problem when compiling “C”, if the “C” program used
those words as identifiers.
- “C”
programs may omit the prototypes, but C++ programs cannot.
- C++
compiler requires keyword void when the parameter list is empty – C does
not.
C++ can be used without its classes, just to be able to use:
- Inline
functions instead of macros
- const
variables instead of #define
- new
and delete instead of free and malloc
- Streams
for I/O
If you are willing to use some classes, then you can also
use:
- The
C++ string class to replace the character array processing of
<cstring>
- The
C++ try/catch/throw exception handling instead of the setjmp/longjmp
functions of C