Rationale for allowing const T* = T* wanted.

Ron Guilmette rfg at lupine.ncd.com
Sat Feb 16 05:50:27 AEST 1991


I have been stirring up trouble in x3j16 (the C++ standardization committee)
with a recent suggestion that C++ ought to allow:

		T** p1;
		const T** p2;

			... p2 = p1;

ANSI C type compatability rules do not allow such assignments.  I would
like to see C++ allow them.

In researching my arguments in favor of this proposal, I turned to the
ANSI C standard and to its rationale document to see if x3j11 had considered
this issue already, and (if so) what their reasons were for rejecting it.

The second paragraph under 3.2.2.3 in the ANSI C standard discusses allowable
conversions of pointer type values where the pointed-at types are qualified by
type qualifiers (i.e. `const' or `volatile' or both).

In the copy of the x3j11 rationale I have however, I see no mention at all
of anything relating to this whole topic.

Could somone who was on x3j11 please describe for me why that committee
decided to allow a `T*' to be assigned to a `const T*' while at the same
time making it illegal to assign a `T**' to a `const T**'?

Thanks in advance.



More information about the Comp.std.c mailing list