Xref: utzoo comp.lang.c++:11241 comp.std.c++:544 Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!think.com!zaphod.mps.ohio-state.edu!usc!apple!vsi1!daver!tscs!tct!chip From: chip@tct.uucp (Chip Salzenberg) Newsgroups: comp.lang.c++,comp.std.c++ Subject: Re: Conversion to |void*| and back: LEGAL Keywords: Sun, C++ Message-ID: <27975414.50A8@tct.uucp> Date: 18 Jan 91 20:01:24 GMT References: <60328@microsoft.UUCP> <278A3278.1241@tct.uucp> <70023@microsoft.UUCP> Followup-To: comp.std.c++ Organization: Teltronics/TCT, Sarasota, FL Lines: 34 [ Standards-related discussion; followups redirected to comp.std.c++ ] According to jimad@microsoft.UUCP (Jim ADCOCK): >In article <278A3278.1241@tct.uucp> chip@tct.uucp (Chip Salzenberg) writes: >|If the text of the ARM does not explicitly support this point, then it >|would seem there is an oversight in the text. > >Agreed that this is the most probable conclusion -- but, this conclusion >doesn't clarify what the oversight was, nor how the ansification >[isofication?] committee will fix it. Okay, here's another line of argument: ANSI C guarantees that any object pointer may be converted to |void *| and back, and that the result will be equal to the original pointer. The "Differences from ANSI C" section of the ARM (18.2) does not rescind that guarantee. Therefore, it must still hold in C++. Note that C++ pointers to user-defined object types cannot be excluded from the above analysis. It is true that ANSI C has no "class" (:-)), but we are discussing pointers, and |struct X *| and |class X *| are the same type. Thus, compatibility with ANSI C requires that this code output "yes": class X { int x; } foo; void *p = &foo; if ((class X *)p == &foo) cout << "yes\n"; -- Chip Salzenberg at Teltronics/TCT , "If Usenet exists, then what is its mailing address?" -- me "c/o The Daily Planet, Metropolis." -- Jeff Daiell