Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!orchid!rbutterworth From: rbutterworth@orchid.UUCP Newsgroups: comp.lang.c Subject: Re: NULL pointers as arguments, really condition expressions Message-ID: <7327@orchid.UUCP> Date: Tue, 5-May-87 10:46:38 EDT Article-I.D.: orchid.7327 Posted: Tue May 5 10:46:38 1987 Date-Received: Wed, 6-May-87 05:45:51 EDT References: <1130@ius2.cs.cmu.edu> <148@nbisos.NBI.COM> <801@rtech.UUCP> Distribution: na Organization: U of Waterloo, Ontario Lines: 22 In article <801@rtech.UUCP>, daveb@rtech.UUCP (Dave Brower) writes: > Which reminds me of a general problem with the conditional operator. > What is the type of the result of evaluating: > (expr) ? (double) x : (char)y > * Take the type of the true expression as the type of the whole. > * Take the type of the false expression... > * Take the type of the lval, if any. > * Take the type of the "biggest" type of the true or false expr. > * Call it an error. I'd call it an error. But how about intptr = (expr) ? void_star_func() : float_star_func() ; I haven't checked the latest draft, but an earlier ANSI draft indicated that the type of ?(void*):(type*) would be (void*). This is definitely not the way it should be, as the above example would compile and lint cleanly even though it is wrong. I hope ANSI has or will change it to indicate that the result of a ":" with a (void*) is the type of the other pointer (and that other mixed used of ":" would be treated according to the usual widening and promotion rules).