Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!snorkelwacker!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Question about Declaration Specifiers Message-ID: <16034@haddock.ima.isc.com> Date: 26 Feb 90 20:21:26 GMT References: <750@umvlsi.ecs.umass.edu> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Distribution: usa Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 22 In article <750@umvlsi.ecs.umass.edu> chittamu@umvlsi (Satish Kumar .C) writes: >The grammar in K & R 2 [implies] we can have declarations of the sort > register const int > const register int > int register const >etc. Right. Mostly for backward compatibility with pre-ANSI C. >I was always under the impression that the rule had to be >Declaration_Specifiers : Type_Qualifier Storage_Class_Specifier Type_Specifier No, in fact the storage class should be the first word (all other orderings are obsolescent). Nothing is said about the relative ordering of qualifier and type specifier, but because of the interaction between qualifiers and `*', it can be argued that the logical ordering is SCS TS TQ: extern int const x; /* x is a constant int */ extern int const * p; /* p is a pointer to a constant int */ extern int * const p; /* p is a constant pointer to an int */ This is my preferred ordering. Opinions will differ. Karl W. Z. Heuer (karl@ima.ima.isc.com or harvard!ima!karl), The Walking Lint