Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!watmum!smvorkoetter From: smvorkoetter@watmum.UUCP Newsgroups: comp.lang.c Subject: Re: COMMA separated expresses Message-ID: <1038@watmum.UUCP> Date: Thu, 25-Jun-87 23:59:15 EDT Article-I.D.: watmum.1038 Posted: Thu Jun 25 23:59:15 1987 Date-Received: Sat, 27-Jun-87 07:19:50 EDT References: <1601@oliveb.UUCP> Reply-To: smvorkoetter@watmum.UUCP (Stefan M. Vorkoetter) Distribution: world Organization: U. of Waterloo, Ontario Lines: 29 In article <1601@oliveb.UUCP> dchen@oliveb.UUCP (Dennis T. Chen) writes: ]Why did my C compiler(came with 4.3bsd) complaint the "syntax error" ]with the following COMMA separated express statements in a function: ] ]funct() ]{ ] int i = 0; ] ] if ( i == 0 ) ] printf("A\n"), return; /* syntax error here */ ] printf("END\n"); ]} ] ]But it works fine with ] ] if ( i == 0 ) ] printf("A\n"), exit(1); /* compile OK */ ] ]Could someone point this out ? It seems to me that rule 7.15 Comma ]operator, on page 192 of C Programming Language doesn't state much ]on this. ] ]Dennis Chen ]{allegra, hplabs, idi, ihnp4, sun}!oliveb!dchen `return' is not an expression, it is a statement. `exit' on the other hand is a function (which never returns, but that is a different story), and is thus an expression.