(j3.2006) Comment 2 from TS Ballot

Malcolm Cohen malcolm
Thu Sep 13 04:31:51 EDT 2012


I wrote:
> Maybe something like
> "If (blah), a pointer derived from the base_addr of that descriptor shall not 
> be
> used to access memory that is not part of the object described by the
> descriptor."

...
>Better.  I'm still a bit concerned that "derived from" is too vague.

I think it is clear in context.

>How about "..., a pointer computed as an offset from the base_addr of
>that descriptor...".   This wording corresponds more directly to what
>the programmer would actually be writing.

Unfortunately "as an offset from" sounds like you have an offset, i.e. 
difference between two addresses, not a pointer.  And now that we have a process 
being described it should probably have a demonstrative pronoun with a verb.

So "..., a pointer that is computed by adding or subtracting an offset to the 
base_addr of that descriptor..." might be ok, but...

"offset" is also not a defined term... any more than my use of "derived" was.

And it makes the following either allowed or at least up for discussion...

  p = x->base_addr + 100;
  /* cannot write to p if it is not part of the described object */
  p = p + 10;
  *p = 3; /* this is ok because we did not get this by adding an offset to the 
base_addr of the descriptor */

So maybe
  "..., a pointer that is computed from the base_addr of the descriptor by 
adding or subtracting one or more integer values ..."
looks better.

OTOH, we have made this so specific there is now a question as to whether &p[10] 
counts since the addition is not written explicitly.

It might be better to stick with "derived", which is clear enough without trying 
to nail down how the programmer derived it.

Cheers,
-- 
................................Malcolm Cohen, Nihon NAG, Tokyo. 




More information about the J3 mailing list