Re: Scalar Pointers Pointing at Array Elements



Richard Maine <nospam@xxxxxxxxxxxxx> wrote:
(snip)

1. When you allocate a pointer, the allocated entity has the target
attribute and thus can be pointed at. That might seem almost a
tautology, but it is a point that has been known to confuse people (such
as me; it was a long time ago, but I do recall once being confused).
After all, the keyword TARGET doesn't appear anywhere; there is only the
keyword pointer. The perhaps subtle distinction is that, although the
pointer doesn't (and can't) have the target attribute, when you allocate
a pointer, that anonymous allocated thing does have the target
attribute.

But one might want to point at a pointer, and not just to the
target of the pointer. That seems much more common in C, though.

-- glen
.



Relevant Pages

  • Re: association with zero-length array?
    ... Requirements for pointer and target association ... POINTER attribute, TARGET attribute, pointer association ... If PTR has the POINTER attribute and TGT has the TARGET or ... and TGT considered to be pointer associated, i.e., under which of the ...
    (comp.lang.fortran)
  • Re: TARGET and INTENT(IN)
    ... you can use a pointer to point at something and then modify it through the pointer. ... A pointer is very much like a dummy argument. ... With this meaning of "TARGET" for INTENTdummys I don't see the point - the compiler still doesn't do anything different than for INTENTdummys without TARGET. ... I've been known to have wrapper routines that try to make life simpler for both the routines that calls them and the lower-level routines that they call. ...
    (comp.lang.fortran)
  • Re: Target attribute for derived-type components in call trees?
    ... any TARGET declaration in the initialization of b_ptr, the pointer ... q point to the same target as p. ... which is why the compiler isn't ... "If the dummy argument has the TARGET attribute and the corresponding ...
    (comp.lang.fortran)
  • Re: Target attribute for derived-type components in call trees?
    ... any TARGET declaration in the initialization of b_ptr, the pointer ... q point to the same target as p. ... which is why the compiler isn't ... "If the dummy argument has the TARGET attribute and the corresponding ...
    (comp.lang.fortran)
  • Re: clarification of protected?
    ... target, even if it hapens to be the only way to access the target at the ... pointer could be anything, ... Setup called elsewhere to initiate proper module use ... Depending on your code design, features like this could be useful - it ...
    (comp.lang.fortran)