allbery@ncoast.UUCP (Brandon Allbery) (07/31/86)
Expires: Quoted from <3183@utcsri.UUCP> ["Re: C Compiler bug (and fix for a different one)"], by greg@utcsri.UUCP (Gregory Smith)... +--------------- | >> void f3(which) | >> { | >> extern void f1(),f2(); | >> which?f1():f2(); | >> } | >> cc(1) gives an "incompatible types" error. | > | >As it should. The only thing you're allowed to do with void values | >is throw them away. | | But it is being thrown away. In e1?e2:e3, the contexts of e2 and e3 are | inherited from the context of the ?: operator itself. In this case, | that is in a 'for effect' or void context, so f1() and f2() should be | treated as 'thrown away' too. +--------------- If the result of ?: were an lvalue, this might be true; but it's not. In effect ?: evaluates its arguments and therefore teh arguments must have values. ++Brandon -- ---------------- /--/ Brandon S. Allbery UUCP: decvax!cwruecmp! / / /|\/ Tridelta Industries, Inc. ncoast!tdi2!brandon ---- -------- /-++ 7350 Corporate Blvd. PHONE: +1 216 974 9210 / / /---, ---- Mentor, Ohio 44060 SYSOP: UNaXcess/ncoast / / / / / / -- HOME -- (216) 781-6201 24 hrs. / / / / / / 6615 Center St. Apt. A1-105 ARPA: ncoast!allbery% ---- -----~ ---- Mentor, Ohio 44060-4101 case.CSNET@csnet-relay