Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: >< swap operator Date: Mon, 08 Oct 2018 10:49:26 -0700 Organization: None to speak of Lines: 39 Message-ID: References: <36d546c5-b471-45fc-b87a-8ebebdc0c0b7@googlegroups.com> <87va6gjile.fsf@bsb.me.uk> <87d0snkcs4.fsf@bsb.me.uk> <87o9c6j4fl.fsf@bsb.me.uk> <87pnwlhp1q.fsf@bsb.me.uk> <3d46f51b-bfcf-4966-8528-aa586e5e0cdb@googlegroups.com> <87zhvpfbob.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="044f0ceb07b55f0a559303158e3458ae"; logging-data="31607"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Bkvt7NrdHdam1B+RnwWon" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:j2rCyfJavNssd6o4kNw8KZVpZm4= sha1:mUyImXb8X+28HhNlwWQ6OFwGI7Y= Xref: csiph.com comp.lang.c:136434 Keith Thompson writes: [...] > There's a possible misunderstanding that occurred to me after I wrote > the above. The semicolon is unambiguously *part of* the syntax of the > statement. For example, this: > > return 42; > > isn't a return statement followed by a semicolon. It's a return > statement consisting of three tokens: `return`, `42`, and `;`. And > there's no explicit general rule about statements being terminated > by semicolons; the grammar production for each kind of statement > (except for the compound-statement) includes the semicolon token. Let me amend my previous, um, statement. There are several kinds of statements whose syntax does not include a trailing semicolon. The ones that do are: expression-statement (which includes the null statement) do/while goto continue break return An if statement, for example, might end in a semicolon if the substatement does. Anyone who thinks semicolons are unimportant should consider if (condition) do_something(); vs. if (condition); do_something(); -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"