(ref.doc)A const source of confusion

Next Wrap them wrascally arrays! Prev: Simplifying the Booch Components Up: cppR 5/5

A const source of confusion
C++ Traps and pitfalls
by Andrew Koenig (Note:
 Koenig)

Declarations and declarators
Remember first that a declaration consists of a *type* and one or more
*declarators*.

When the C standards committee added the notion of const, one of their
goals was to make it unnecessary to go back and put const into a lot
of existing programs.

	int n = countblanks("How many blanks?");
Thus we come to the surprising conclusion that the type of "How many
blanks?" must be char*, with no const in sight!

In fact, there is no conversion from char** to const char**.

The conversion from const char** to const char* const* is just a
conversion from T* to const T*.

It [the conversion from char** to const char**] was discussed in the
Portland meeting in March 1993 and passed by a wide margin.

There is still room for liberalizing the rules, especially when doing
so is both safe and useful.


automatically generated by info2www version 1.2.2.8