The most important difference between
pointers in C and those in C++ is that
C++ is a
more strongly typed language. This stands out where
void*
is concerned. C doesn’t let you casually assign a pointer of one type to
another, but it does allow you to accomplish this through a void*.
Thus,
Because this “feature” of C
allows you to quietly treat any type like any other type, it leaves a big
hole in the type system. C++ doesn’t allow this;
the compiler gives you an error message, and if you really want to treat one
type as another, you must make it explicit, both to the compiler and to the
reader, using a cast. (Chapter 3 introduced C++’s improved
“explicit” casting
syntax.)