On Fri, 22 Oct 2004 20:16:40 +0200, jacob navia
C++ accepts most of the C89 syntax. Yes, there are
several problems with some C constructs, but *most*
of C is still legal C++ I am sorry, this is an evidence.
Given this corrected claim (not "all") there are still a few cases
where C++ fixes to a minor extent some of the problems from C.
Biggest is that functions must be declared and in prototype syntax,
which eliminates some of the opportunities for mismatching calls.
Further, though it isn't inherent in the language or officially
required, all practical C++ implementations to support overloading use
"typesafe" linking which catches some -- not all -- mismatched
function declarations, while C implementations (except yours) don't
need to and usually don't.
The implicit conversion from void* to any (possibly wrong) object
pointer is gone, although you still can do the (explicit) cast with
equally bad results. enums are distinct types and don't implicitly
convert from other enums (that were intended to be distinct), or from
integers although IME that is less often a problem.
A few string functions like strchr are overloaded to be const-safe,
and string literal values are officially const -- although they still
deprecatedly convert to a nonconst pointer (yuck!).
And C++ provides _alternatives_ to some of the things that are often
problems in C: std::string, vector and valarray, *streams with << >>,
new/delete (though delete[] is still a landmine), smart pointers that
can force initialization and do reference counting and/or GC. But
you're right that nearly all the things that are commonly problems in
C are still possible in C++.
- David.Thompson1 at worldnet.att.net