Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Untyped Variables |
| Date | 2015-08-10 19:03 -0700 |
| Organization | None to speak of |
| Message-ID | <lnwpx2d1jm.fsf@kst-u.example.com> (permalink) |
| References | (2 earlier) <8eb33dc8-5c47-4b7b-a20e-584166a50d58@googlegroups.com> <55C69FFA.7050309@verizon.net> <mqaadk$2hpv$1@macpro.inf.ed.ac.uk> <fa3e2bb7-f1ac-468c-83bb-282deec9b26d@googlegroups.com> <87h9o6bquz.fsf@bsb.me.uk> |
Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> David Kleinecke <dkleinecke@gmail.com> writes:
>> On Monday, August 10, 2015 at 6:55:11 AM UTC-7, Richard Tobin wrote:
>>> In article <55C69FFA.7050309@verizon.net>,
>>> James Kuyper <jameskuyper@verizon.net> wrote:
>>>
>>> >On 08/08/2015 07:06 PM, David Kleinecke wrote:
>>> >...
>>> >> I haven't been thinking of constraints as part of syntax. ...
>>>
>>> >It would be more accurate to say that some constraints constrain the
>>> >syntax.
>>>
>>> It would make sense that a program must conform to both the grammar
>>> and the constraints.
>>>
>>> But in the case of implicit int in C90, the "constraint" in 6.5.2
>>> explicitly allows something that is not allowed by the grammar.
>>
>> If you are saying that the constraint explicitly legalizes
>> a;
>> you are IMO wrong. It legalizes having no type specifier but the
>> storage-class-specifiers and type-qualifiers remain to fulfill the
>> grammar's requirement for a declaration-specifier.
>
> I can't see how you arrive at that conclusion. The grammar permits
> declarations with nothing but type specifiers, and the constraint (which
> is really a permission in the this case) permits these to consist of no
> type specifiers. Where do you find support for your view that there
> must be a storage class or type qualifier when here is no type
> specifier?
The syntax for a declaration, in C90 6.5, indicates that a declaration
must begin with a storage-class-specifier, a type-specifier, or a
type-qualifier. This makes
a;
a syntax error (at file scope, where statements are not permitted).
The constraint in C90 6.5.2 says that "Each list of type specifiers
shall be one of the following sets ...", where "no type specifiers" is
one possibility, grouped with int, signed, and signed int.
The constraint forbids things like "void float" (or "long long", which
was not permitted prior to C99).
6.5.2 specifies the *meaning* of a declaration with no type specifiers,
such as
auto x;
volatile y;
z();
It does not change the context in which such a declaration is
permitted. In particular, it does not override the grammar to
permit a declaration that doesn't have a storage class specifier,
a type specifier, *or* a type qualifier. An empty sequence of type
specifiers is permitted only in a declaration that has a storage
class specifier and/or a type qualifier.
(This differs from what I wrote earlier; I changed my mind.)
I previously said that I thought earlier versions of C permitted a
declaration like x; at file scope. In a 1975 C reference manual
(3 years before K&R1), the syntax of a declaration requires it
to start with a type specifier, or a storage class specifier, or
both, in either order, so apparently I was mistaken on that point.
Some compilers might have permitted such declarations anyway.
(B did permit such declarations at file scope.)
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
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"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Untyped Variables David Kleinecke <dkleinecke@gmail.com> - 2015-08-07 18:19 -0700
Re: Untyped Variables Lőrinczy Zsigmond <nospam@for.me> - 2015-08-08 06:53 +0200
Re: Untyped Variables James Kuyper <jameskuyper@verizon.net> - 2015-08-08 11:09 -0400
Re: Untyped Variables Keith Thompson <kst-u@mib.org> - 2015-08-08 12:09 -0700
Re: Untyped Variables James Kuyper <jameskuyper@verizon.net> - 2015-08-08 14:24 -0400
Re: Untyped Variables Keith Thompson <kst-u@mib.org> - 2015-08-08 12:54 -0700
Re: Untyped Variables David Kleinecke <dkleinecke@gmail.com> - 2015-08-08 16:06 -0700
Re: Untyped Variables Keith Thompson <kst-u@mib.org> - 2015-08-08 17:29 -0700
Re: Untyped Variables David Kleinecke <dkleinecke@gmail.com> - 2015-08-09 17:52 -0700
Re: Untyped Variables Ian Collins <ian-news@hotmail.com> - 2015-08-10 12:57 +1200
Re: Untyped Variables Keith Thompson <kst-u@mib.org> - 2015-08-10 08:41 -0700
Re: Untyped Variables David Kleinecke <dkleinecke@gmail.com> - 2015-08-10 17:06 -0700
Re: Untyped Variables Richard Damon <Richard@Damon-Family.org> - 2015-08-08 19:44 -0400
Re: Untyped Variables James Kuyper <jameskuyper@verizon.net> - 2015-08-08 20:34 -0400
Re: Untyped Variables glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-09 02:03 +0000
Re: Untyped Variables Richard Damon <Richard@Damon-Family.org> - 2015-08-08 22:52 -0400
Re: Untyped Variables glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-09 04:57 +0000
Re: Untyped Variables Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2015-08-09 09:58 -0600
Re: Untyped Variables Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-10 03:54 -0700
Re: Untyped Variables Richard Damon <Richard@Damon-Family.org> - 2015-08-09 16:59 -0400
Re: Untyped Variables David Kleinecke <dkleinecke@gmail.com> - 2015-08-09 18:02 -0700
Re: Untyped Variables James Kuyper <jameskuyper@verizon.net> - 2015-08-10 11:01 -0400
Re: Untyped Variables James Kuyper <jameskuyper@verizon.net> - 2015-08-10 13:20 -0400
Re: Untyped Variables David Kleinecke <dkleinecke@gmail.com> - 2015-08-10 16:54 -0700
Re: Untyped Variables James Kuyper <jameskuyper@verizon.net> - 2015-08-11 00:20 -0400
Re: Untyped Variables Keith Thompson <kst-u@mib.org> - 2015-08-10 08:11 -0700
Re: Untyped Variables David Kleinecke <dkleinecke@gmail.com> - 2015-08-10 17:15 -0700
Re: Untyped Variables James Kuyper <jameskuyper@verizon.net> - 2015-08-11 00:30 -0400
Re: Untyped Variables David Kleinecke <dkleinecke@gmail.com> - 2015-08-11 16:50 -0700
Re: Untyped Variables Keith Thompson <kst-u@mib.org> - 2015-08-11 17:24 -0700
Re: Untyped Variables Richard Heathfield <rjh@cpax.org.uk> - 2015-08-12 01:37 +0100
Re: Untyped Variables glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-12 04:46 +0000
Re: Untyped Variables David Kleinecke <dkleinecke@gmail.com> - 2015-08-12 18:12 -0700
Re: Untyped Variables Keith Thompson <kst-u@mib.org> - 2015-08-13 12:08 -0700
Re: Untyped Variables David Kleinecke <dkleinecke@gmail.com> - 2015-08-13 16:25 -0700
Re: Untyped Variables Keith Thompson <kst-u@mib.org> - 2015-08-14 10:36 -0700
Re: Untyped Variables Bartc <bc@freeuk.com> - 2015-08-14 19:13 +0100
Re: Untyped Variables Keith Thompson <kst-u@mib.org> - 2015-08-11 07:58 -0700
Re: Untyped Variables richard@cogsci.ed.ac.uk (Richard Tobin) - 2015-08-10 13:53 +0000
Re: Untyped Variables Keith Thompson <kst-u@mib.org> - 2015-08-10 08:29 -0700
Re: Untyped Variables David Kleinecke <dkleinecke@gmail.com> - 2015-08-10 17:01 -0700
Re: Untyped Variables Keith Thompson <kst-u@mib.org> - 2015-08-10 17:42 -0700
Re: Untyped Variables glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-08-11 02:56 +0000
Re: Untyped Variables David Kleinecke <dkleinecke@gmail.com> - 2015-08-10 16:50 -0700
Re: Untyped Variables Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-11 01:39 +0100
Re: Untyped Variables Keith Thompson <kst-u@mib.org> - 2015-08-10 19:03 -0700
Re: Untyped Variables Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-11 11:21 +0100
Re: Untyped Variables David Kleinecke <dkleinecke@gmail.com> - 2015-08-11 16:37 -0700
csiph-web