> >         struct foo {int x; float y; } bar;
> >         int *pi;
> >         float *pf;
> >
> > and mark X as "nonaddressable", I know that an assigment to *pi can't
> > affect bar.x.
> 
> But if you add
> 
> struct foo *foop = &bar.
> 
> foop->x = 5.
> 
> It can, even though we *claim* X is nonaddressable.

I don't follow.  It's still the case that

        *pi = 10;

cannot change bar.x.  Making a pointer to the entire structure doesn't
change that.

> If you told me this is what you meant by "nonaddressable", i'd
> probably call you crazy.
> 
> It is most certainly addressable, because you can form the address of it.

I'd certainly have no problem replacing that name with a better one.
The Ada terminology is "aliased", but that seemed too obscure.  The name
doesn't refer to the machine-level concept of "address", but to the C
operator "&", which is normally called "address of".  DECL_NONADDRESSABLE_P
means you can't apply the C operator "&" to that field.

Reply via email to