Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: A question on variable scope, coming from a relative beginner Date: Thu, 12 Nov 2015 22:13:52 -0800 Organization: None to speak of Lines: 32 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="14376"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX186yEkIVJxe0y9E4SPUisu1" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:7o1XYsjqJFG0WvJOtSM1f+5Quz4= sha1:qcCA0D3ClhfnqiMsbVY+gVExFTI= Xref: csiph.com comp.lang.c:75925 Jon Rossen writes: > On 11/12/2015 4:25 PM, Stefan Ram wrote: >> Jon Rossen writes: >>> extern int x; // This entire statement is not necessary to >> >> It's not a statement, it's a declaration (a block-item). >> >>> omit the 'extern int x' statement completely, >> >> »extern int ׫ is not a statement. >> > > Couldn't it be considered both? In other words can't the term > 'statement' be considered a superset that includes smaller subsets such > as declarations? It *could* be, but it isn't. The C standard defines what a "declaration" is, and what a "statement" is, and they're disjoint sets. There's no fundamental reason for that, it's just the way the standard defines the terms. (In C++, a declaration is considered a kind of statement. That may have been influenced by the fact that C++ permitted mixed declarations and statements before C did; C added that feature in C99, but didn't change the meanings of "statement" and "declaration".) -- 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"