Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!sundc!hadron!jsdy From: jsdy@hadron.UUCP (Joseph S. D. Yao) Newsgroups: net.lang.c,net.bugs Subject: Re: C Compiler bug (and fix for a different one) Message-ID: <504@hadron.UUCP> Date: Thu, 31-Jul-86 01:35:20 EDT Article-I.D.: hadron.504 Posted: Thu Jul 31 01:35:20 1986 Date-Received: Thu, 31-Jul-86 23:47:17 EDT References: <273@watmath.UUCP> <5858@alice.uUCp> <461@watmath.UUCP> Reply-To: jsdy@hadron.UUCP (Joseph S. D. Yao) Organization: Hadron, Inc., Fairfax, VA Lines: 28 Summary: (A) Different version mof X3J11? (B) Counter-intuitive. Xref: mnetor net.lang.c:5509 net.bugs:300 In article <461@watmath.UUCP> rbutterworth@watmath.UUCP (Ray Butterworth) writes: >> > 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. >If I'm not throwing them away, what is it you think I'm doing with them? >Also, the proposed ANSI draft explicitly states that the second and third >operands of ?: may each have (void) type, so I'm not trying anything >unusual here. My 1984 version of X3J11 (has it been that long?) agrees with K&R that each of the operands must have a value. This makes intuitive sense. The meaning of X ? Y : Z is: an expression whose value is the value of Y, if the value of X is non-zero; otherwise, the value of Z. By this, all three must evaluate to some value. Do you have a more recent edition of X3J11 that r e a l l y lets voids in there? Ugh! (What date?) Besides which, all C compilers until just recently (Lattice, Microsoft) had been written to K&R and v7-s3-s5, not to the ANSI standard. -- Joe Yao hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP} jsdy@hadron.COM (not yet domainised)