Newsgroups: comp.std.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Interaction between storage class and qualifiers Message-ID: <1991Jan8.000756.24432@zoo.toronto.edu> Organization: U of Toronto Zoology References: <2760@charon.cwi.nl> Date: Tue, 8 Jan 1991 00:07:56 GMT In article <2760@charon.cwi.nl> jack@cwi.nl (Jack Jansen) writes: >The SGI C compiler treats the following two pointers as unequal: > register volatile struct foo *p1; > volatile register struct foo *p2; >p1 is a pointer (in a register) to a volatile struct foo, while >p2 is a volatile pointer (in a register) to a struct foo. This is incorrect. The standard attributes no significance to the order of storage class specifiers, type specifiers, and type qualifiers in the declaration-specifiers list beginning a declaration. The type specifiers (in this case `struct foo') and type qualifiers (`volatile') all go to forming the "base type", so to speak, for the declaration. The way to declare a volatile pointer (in a register) to a struct foo is register struct foo * volatile p3; See the pointer-declarator rules in 3.5.4.1. >... I haven't been able to find anything in >the standard about the interaction of storage classes and type >qualifiers. That's because there is none. The storage class is completely independent of the type. -- If the Space Shuttle was the answer, | Henry Spencer at U of Toronto Zoology what was the question? | henry@zoo.toronto.edu utzoo!henry