Newsgroups: comp.lang.c++
Path: utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!geac!alias!rae
From: rae@alias.com (Reid Ellis)
Subject: Re: Pointers to sibling classes in conditional expressions
Message-ID: <1991Apr29.173219.29532@alias.com>
Sender: news@alias.com (USENET News)
Organization: Alias Research, Inc. Toronto ON Canada
References: <ROBERTK.91Apr25110048@lotatg.lotus.com> <1991Apr26.152511.14662@watson.ibm.com>
Distribution: comp
Date: Mon, 29 Apr 91 17:32:19 GMT

Josh Mittleman <mittle@blinn.watson.ibm.com> writes:
>My initial reaction was that this is a compiler error.  ARM, p.78, lays out
>the rules for correctly formed conditional expressions:
>
>"If both the second and the third expressions are of arithmetic type, the
>usual arithmetic conversions are performed to bring them to a common type.
>Otherwise, if both the second and the third expressions are either a
>pointer or a constant expression that evaluates to 0, pointer conversions
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>are performed to bring them to a common type.  Otherwise, if both the
>second and the third expressions are either references, reference
                                                         +++++++++
>conversions are performed to bring them to a common type.  Otherwise if
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>both the second and the third expressions are void, the common type is
>void.  Otherwise if both the second and the third expressions are the same
>class T, the common type is T.  Otherwise the expression is illegal."

I think the problem is in the "^^" marked phrase above.  On first
reading, it would seem to indicate "(a pointer that evaluates to 0) or
(a constant expression that evaluates to 0)".  But after some thought,
and especially after reading the section marked with "+" above, it
would seem that that phrase should be read as "(a pointer) or (a
constant expression that evaluates to 0)".

Is this the case?  Are ?: expressions broken in AT&T cfront
derivatives for this reason?  Is the ANSI draft more explicit on this?

		"... and what about.. Naomie?"
			-- Electric Company

						Reid
--
Reid Ellis     1 Trefan Street Apt. E, Toronto ON, M5A 3A9
rae@utcs.toronto.edu        ||               rae@alias.com
CDA0610@applelink.apple.com ||      +1 416 362 9181 [work]
