Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!caip!princeton!allegra!alice!bs From: bs@alice.UucP (Bjarne Stroustrup) Newsgroups: net.lang.c Subject: void Message-ID: <5893@alice.uUCp> Date: Fri, 1-Aug-86 21:30:23 EDT Article-I.D.: alice.5893 Posted: Fri Aug 1 21:30:23 1986 Date-Received: Sat, 2-Aug-86 22:01:47 EDT Organization: Bell Labs, Murray Hill Lines: 35 I tried a little program on the three 8th Edition UNIX C compilers: cc - the standard C compiler cyntax - a very competent C checker CC - the C++ compiler void f1(), f2(); int f3(); void h() { int i; /* cc cyntax CC */ f1(); /* */ i = f1(); /* error error error */ f1(),f2(); /* */ f1(),f3(); /* */ i = (f1(),f2()); /* error error error */ i = (f1(),f3()); /* */ i?f1():f3(); /* error */ i = i?f1():f2(); /* error error error */ i = i?f1():f3(); /* error error error */ } They don't like assigning a void to an int. They don't mind an operand of ``,'' being void as long as it is not assigned to anything. They all agree that the second and third operands of ?: must be of the same type (modulo standard conversions). cc insists that an operand of ?: must not be void even if it is not used; cyntax and CC disagree. I think cyntax and CC are right. It is inconsistent to allow an operand to ``,'' to be void provided it is not used and at the same time to disallow an operand of ``?;'' from being void even when it is not used. I think cc's behaviour is a leftover from the days where there were no void.