Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!pdn!tscs!tct!chip From: chip@tct.uucp (Chip Salzenberg) Newsgroups: comp.lang.c++ Subject: Re: Comparison functions for qsort() and bsearch() Keywords: Sun, C++ Message-ID: <278A3278.1241@tct.uucp> Date: 8 Jan 91 20:58:31 GMT References: <1990Dec26.160636.15566@clear.com> <1991Jan2.191630.18581@Think.COM> <60328@microsoft.UUCP> Organization: Teltronics/TCT, Sarasota, FL Lines: 23 According to jimad@microsoft.UUCP (Jim ADCOCK): >I claim either: > >1) Casts from a void* to a pointer to an object of some class already >defined are in error. >or >2) The definitions given by ARM pgs 67-71 are in error. From the ARM, page 36 [commentary]: "ANSI C allows an IMPLICIT conversion from a pointer to |void| to a pointer to another object type (but not to a pointer to function type ...); in C++ a |void*| cannot be assigned to an object of any type other than |void*| WITHOUT AN EXPLICIT CAST." (Emphasis mine.) So if you _do_ use an explicit cast, you may convert a |void*| to an object of some class already defined. If the text of the ARM does not explicitly support this point, then it would seem there is an oversight in the text. -- Chip Salzenberg at Teltronics/TCT , "If Usenet exists, then what is its mailing address?" -- me "c/o The Daily Planet, Metropolis." -- Jeff Daiell