Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Small Device C Compiler 3.6.0 released Date: Mon, 13 Jun 2016 16:35:30 -0700 Organization: None to speak of Lines: 53 Message-ID: References: <874m8x2b3m.fsf@bsb.me.uk> <87y46825no.fsf@bsb.me.uk> <87pork1zyk.fsf@bsb.me.uk> <21a7e10d-2cf6-5ad2-cfe4-3a9b2a725d28@verizon.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="6758"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Jr+s08WLxGoVSzj0G4qgH" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:b54GvDvlMAX/wgoBSLLkSilObPc= sha1:O76JhwQ1IKV2SgPdic5l17X/jIE= Xref: csiph.com comp.lang.c:89056 "James R. Kuyper" writes: > On 06/13/2016 06:33 PM, Ben Bacarisse wrote: > ... >> ... (Pre-K&R C did not permit >> declarations in compound statements.) > > The earliest version of C I've ever used was K&R C, in 1979. Were the > relevant terms defined differently in pre-K&R C? > > 6.9.1p1: > function-definition: > declaration-specifiers declarator declaration-listopt compound-statement Yes. K&R C (1st edition, 1978) has: compound-statement { declaration-list(opt) statement-list(opt) } which permits declarations either at the top level of a function or in a nested block. (I've represented the subscript "opt" as "(opt)".) https://www.bell-labs.com/usr/dmr/www/cman.pdf (1975, I think) has: compound-statement: { statement-list } statement-list: statement statement statement-list (Interestingly, this implies there must be at least one statement. An appendix mentions that GCOS requires this, but UNIX does not.) It also says: The function-body has the form function-body: type-decl-list function-statement ... The function-statement is just a compound statement which may have declarations at the start. function-statement: { declaration-list statement-list(opt) } So declarations are permitted only at the top of the outermost compound statement of a function body. -- 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"