Interaction between storage class and qualifiers
Henry Spencer
henry at zoo.toronto.edu
Tue Jan 8 11:07:56 AEST 1991
In article <2760 at charon.cwi.nl> jack at 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 at zoo.toronto.edu utzoo!henry
More information about the Comp.std.c
mailing list