From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu Subject: Re: [9fans] const declarators in structs From: Richard Miller MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Message-Id: Date: Thu, 16 Nov 2000 21:23:28 +0000 Topicbox-Message-UUID: 2c24cfcc-eac9-11e9-9e20-41e7f4b1d025 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