Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #59412

Re: struct tag (*[5])(float)

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: struct tag (*[5])(float)
Date 2015-04-01 17:40 -0400
Organization Self
Message-ID <551C65E3.8010903@verizon.net> (permalink)
References <mfhjtf$plc$1@dont-email.me>

Show all headers | View raw


On 04/01/2015 04:17 PM, James Harris wrote:
> The type
> 
>   struct tag (*[5])(float)
> 
> appears in at least two draft C standards: for C89 and the n869 pdf. I 
> find it hard to read because it has no identifier. I can see where an 
> identifier can be placed but how is a programmer *supposed* to parse 
> such a "type" when reading a standard? Is it as simple as knowing which 
> symbols are prefixes and which would be suffixes?
> 
> James

What you are talking about is described in 6.7.7p2:
"In several contexts, it is necessary to specify a type. This is
accomplished using a _type name_, which is syntactically a declaration
for a function or an object of that type that omits the identifier.".
I'm using underscores to mark the fact that "type name" is in italics, a
convention used in ISO standards to indicate that the clause it appears
in is, officially, the definition for the italicized term.

Whenever a type name is allowed, if the code that you're parsing matches
one of the grammar productions in 6.7.7p1, then it is a type name. Since
and identifier qualifies as a direct-declarator (6.7.6p1), but does NOT
qualify as a direct-abstract-declarator (6.7.7p1), in order to match
those grammar rules, you must sooner or later parse it down to the point
where an optional abstract-declarator or direct-abstract-declarator is
missing - and that's precisely where the missing identifier would go.
Insert an arbitrary dummy identifier in that location, and the type name
should make sense as a declaration.

The examples given in 6.7p3 might help clarify this issue.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

struct tag (*[5])(float) "James Harris" <james.harris.1@gmail.com> - 2015-04-01 21:17 +0100
  Re: struct tag (*[5])(float) James Kuyper <jameskuyper@verizon.net> - 2015-04-01 17:40 -0400
    Re: struct tag (*[5])(float) Bartc <bc@freeuk.com> - 2015-04-01 22:55 +0100
      Re: struct tag (*[5])(float) Barry Schwarz <schwarzb@dqel.com> - 2015-04-01 16:01 -0700
        Re: struct tag (*[5])(float) James Kuyper <jameskuyper@verizon.net> - 2015-04-01 19:29 -0400
          Re: struct tag (*[5])(float) Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-04-02 05:28 -0700
        Re: struct tag (*[5])(float) Bartc <bc@freeuk.com> - 2015-04-02 00:37 +0100
      Re: struct tag (*[5])(float) Keith Thompson <kst-u@mib.org> - 2015-04-01 20:13 -0700
        Re: struct tag (*[5])(float) Bartc <bc@freeuk.com> - 2015-04-02 10:30 +0100
          Re: struct tag (*[5])(float) Keith Thompson <kst-u@mib.org> - 2015-04-02 15:18 -0700
  Re: struct tag (*[5])(float) John Bode <jfbode1029@gmail.com> - 2015-04-02 15:22 -0700

csiph-web