Topic: Implicit conversion to const void *


Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 21 Dec 1994 18:31:36 GMT
Raw View
In article 1hr@seattle.polstra.com, jdp@polstra.com (John Polstra) writes:
>Section 4.6 (Pointer Conversions) of the ARM says:
>
>    A pointer to any non-const and non-volatile object type may be
>    converted to a void *.
>
>But it does not explicitly state that a pointer to a const object type
>may be converted to a const void *.  Is there a standard conversion of
>that kind?

Simple omission in the ARM. The WP has been corrected to say that the
const and volatile specifications are preserved on implicit conversion
to a void* type.


---
Steve Clamage, stephen.clamage@eng.sun.com






Author: jdp@polstra.com (John Polstra)
Date: 20 Dec 1994 17:07:35 -0800
Raw View
Section 4.6 (Pointer Conversions) of the ARM says:

    A pointer to any non-const and non-volatile object type may be
    converted to a void *.

But it does not explicitly state that a pointer to a const object type
may be converted to a const void *.  Is there a standard conversion of
that kind?

It seems to me that this implicit conversion needs to be (and is) present
in the language.  For example, in Stroustrup 2nd edition, section
10.2.1, he discusses ostream::operator<<(const void *), whose purpose is
to print a pointer value "in a form appropriate to the architecture of
the machine used."  But, I can't find anything in the ARM that mentions
any standard conversion to const void *.  Is this spelled out in the
working paper?
--
   John Polstra                                       jdp@polstra.com
   John D. Polstra & Co., Inc.                   Phone (206) 932-6482
   Seattle, Washington USA                         Fax (206) 935-1262
   "Self-knowledge is always bad news."                 -- John Barth