Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!microsoft!jimad From: jimad@microsoft.UUCP (Jim ADCOCK) Newsgroups: comp.lang.c++ Subject: Re: Comparison functions for qsort() and bsearch() Keywords: Sun, C++ Message-ID: <70023@microsoft.UUCP> Date: 15 Jan 91 00:23:13 GMT References: <1990Dec26.160636.15566@clear.com> <1991Jan2.191630.18581@Think.COM> <60328@microsoft.UUCP> <278A3278.1241@tct.uucp> Reply-To: jimad@microsoft.UUCP (Jim ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 33 In article <278A3278.1241@tct.uucp> chip@tct.uucp (Chip Salzenberg) writes: |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. I disagree. 1) the text you quote is in the form of a prohibition. A prohibition cannot create permissions that do not otherwise exist. 2) the text you quote is a commentary, and thus not binding anyway. The commentary implies that one _might_ have some rights in some cases to cast from void using explicit cast -- but does not imply where and when and with what restrictions those rights might exist. |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.