chip@tct.uucp (Chip Salzenberg) (02/03/91)
According to jimad@microsoft.UUCP (Jim ADCOCK): >I see nothing in ARM that gives one permission to explicitly cast >back from a void* back to the original object* type. Nor do I, lamentably. >What C++ does permit is casting back from a pointer to a smaller object. >I don't see anywhere ARM defines that the effective size of a void object... Aha! This is yet another reason why such a cast-back must be supported by any minimally sane C++ implementation. To wit: For compatibility with ANSI C, a C++ implementation must represent |char*| and |void*| identically -- that is, if you call a C function that expects a |void*| and give it a |char*|, or vice versa, it has to work correctly -- even if the prototype has it wrong. So given (1) the |T*| -> |char*| -> |T*| conversion must work, and (2) |char*| and |void*| must have identical representations, thus we can conclude that |T*| -> |void*| -> |T*| will certainly work in any C++ implementation that isn't terminally stupid. -- Chip Salzenberg at Teltronics/TCT <chip@tct.uucp>, <uunet!pdn!tct!chip> "I want to mention that my opinions whether real or not are MY opinions." -- the inevitable William "Billy" Steinmetz