Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Untyped Variables |
| Date | 2015-08-11 00:20 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <mqbt33$bkk$1@dont-email.me> (permalink) |
| References | (3 earlier) <8eb33dc8-5c47-4b7b-a20e-584166a50d58@googlegroups.com> <55C69FFA.7050309@verizon.net> <ba0351fd-385d-4bc1-b947-380e83defb2b@googlegroups.com> <mqaea6$3qq$1@dont-email.me> <fe2da407-a032-4a25-b5af-d1c60fc3bd68@googlegroups.com> |
On 08/10/2015 07:54 PM, David Kleinecke wrote:
> On Monday, August 10, 2015 at 8:02:10 AM UTC-7, James Kuyper wrote:
>> On 08/09/2015 09:02 PM, David Kleinecke wrote:
>>> On Saturday, August 8, 2015 at 5:34:12 PM UTC-7, James Kuyper 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. For example (6.4.3p1):
>>>>
>>>>
>>>>> 1 universal-character-name:
>>>>> \u hex-quad
>>>>> \U hex-quad hex-quad
>>>>> hex-quad:
>>>>> hexadecimal-digit hexadecimal-digit
>>>>> hexadecimal-digit hexadecimal-digit
>>>>>
>>>>> Constraints
>>>>> 2 A universal character name shall not specify a character whose short identifier is less than
>>>>> 00A0 other than 0024 ($), 0040 (@), or 0060 ('), nor one in the range D800 through
>>>>> DFFF inclusive.73)
>>>>
>>>> In general, the constrained syntax could alternatively have been
>>>> described using only syntax rules. If a constraint was used, it's
>>>> generally because expressing the same idea with syntax rules would have
>>>> made it much more complex. For example:
>> ...
>>> I, as always am only talking C90.
>>
>> I gave the first example I could find of a semantic constraint. I was
>> only intending it as a proof of principle.
>>
>> If you want to restrict your attention to constraints that were present
>> in C90, look for the C90 equivalent of the following C2011 constraint:
>> "At most, one storage-class specifier may be given in the declaration
>> specifiers in a declaration ..." (6.7.1p2). Something like that should
>> be present in C90, possibly with slightly different wording or a
>> different section number.
>
> The constraint is there. I just consider it a semantic constraint rather
> than a syntactic one.
In line with your question down below, let me ask you what definitions
you use for "syntactic" and "semantic" that support that conclusion.
>> That is a purely syntactic constraint, but because the standard allows
>> storage-class-specifiers to be mixed freely with the other kinds of
>> declaration-specifiers (6.7p1), I don't see any way to impose that same
>> requirement using only syntax rules of the form used by the standard -
>> possibly I'm being insufficiently clever.
>>
>>> But I don't see why the syntax you
>>> quote can't pass the details to semantics.
>>
>> Possibly - but that's not relevant to my point - which is that this is
>> is, as currently written, a purely syntactic constraint.
>
> You appear to have a a definition of "syntactic" in mind that allows
> you to declare it a "purely syntactic constraint" Are you willing to
> share that definition?
Quoting wikipedia:
"syntax is the set of rules, principles, and processes that govern the
structure of sentences in a given language."
"Semantics ... is the study of meaning. It focuses on the relation
between signifiers, like words, phrases, signs, and symbols, and what
they stand for; their denotation."
In both cases, 6.4.3p1 and 6.7.1p2, the constraint merely imposes
restrictions on the structure of the program, without regard to it's
meaning.
6.4.3p1 makes it a constraint violation to write a UCN containing
certain sequences of hexadecimal digits. hexadecimal digits and UCNs are
purely syntactic constructs, defined in sections labeled "syntax", and
the rule is given in terms of them. The fact that a diagnostic message
is required if your program contains the token "\u0012" is not
intrinsically different from the fact that a diagnostic message is
required if it contains the token $status . The first is ruled out by a
syntactic constraint, the second is ruled out by the fact that $status
doesn't match the form of any type of token permitted by the syntax
rules, but the nature of the restriction is the same.
6.7.1p2 makes it constraint violation to have more than one
storage-class-specifier in a a declaration. Storage class specifiers and
declarations are purely syntactic constructs, defined as such in
sections labeled "Syntax", and the rule is given in terms of them. The
fact that a diagnostic message is required if your program contains the
tokens "typedef extern int eint;" is not fundamentally different from
the fact that a diagnostic message is required for "5 5 + 3". In each
case, there's one more token of a given type than is allowed - the fact
that the first violates a constraint and the second violates syntax
rules doesn't change the fact that it's the syntax that is incorrect.
In contrast, 6.4.4p2 is a semantic constraint: "Each constant shall have
a type and the value of a constant shall be in the range of
representable values for its type." The type and value of a constant are
semantic features, having to do with the meaning of those constants,
which is why they are described in the sections labeled "Semantics":
6.4.4.1p4-6, 6.4.4.2p3-5, 6.4.4.3p2, 6.4.4.4p10-15.
--
James Kuyper
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