9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Richard Miller <miller@hamnavoe.demon.co.uk>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] const declarators in structs
Date: Thu, 16 Nov 2000 21:23:28 +0000	[thread overview]
Message-ID: <E13wWZR-000Gm6-0A@finch-post-10.mail.demon.net> (raw)

stephen.parker@pitechnology.com reports a misleading C compiler error message from:

struct S {
	int const *p;
};

The underlying cause is that the compiler expects const/volatile keywords before
other simple type names in a structure/union element declarator (but nowhere else) --
in the same context "const int *p" is considered acceptable.

Is this a deliberate choice or an oversight?  If the latter, a simple correction
is to change the grammar as follows:

/sys/src/cmd/cc/cc.y:216 c cc.y:216
< 	etlist
---
> 	tlist
/sys/src/cmd/cc/cc.y:221 c cc.y:221
< |	edecl etlist
---
> |	edecl tlist

The definitions of etlist, etypes and tnlist then become redundant and can be
pruned from cc.y as well.

-- Richard Miller



             reply	other threads:[~2000-11-16 21:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-16 21:23 Richard Miller [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-11-16 10:35 Stephen Parker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E13wWZR-000Gm6-0A@finch-post-10.mail.demon.net \
    --to=miller@hamnavoe.demon.co.uk \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).