the "const" qualifier
Walter Murray
walter at hpcllca.HP.COM
Fri Aug 10 08:01:23 AEST 1990
Larry Jones:
>It seems to me that there used to be a statement in the standard that
>said basically that if an aggregate is qualified, all of the members
>are effectively qualified, and if a member of an aggregate is
>qualified, then the aggregate is effectively qualified. Now I don't
>seem to be able to find it. Am I imagining things again, did I miss
>it, or did we remove it?
Doug Gwyn:
>Yeah, I was looking for that too, and I didn't find it either.
>The only thing I found that was at all relevant said that a qualifier
>in an array declaration actually qualifies the elements of the array,
>not the array itself. However, that's not what we're looking for..
>I have no idea what might have happened to the part<->whole clause.
If you access a member of a struct or union that has qualified type,
using the . operator or the -> operator, the qualifiers of the
struct or union apply to the member. Section 3.3.2.3.
Going the other way, a struct or union can't be a modifiable lvalue
if it has a member with a const-qualified type. Section 3.2.2.1.
Taken with the semantics rules in 3.5.3, these seem to provide what
we are looking for.
Walter Murray
----------
More information about the Comp.std.c
mailing list