Re: a history question

From: Richard E Maine (nospam_at_see.signature)
Date: 09/29/04


Date: 29 Sep 2004 08:40:29 -0700

Rich Townsend <rhdt@barVOIDtol.udel.edu> writes:

> How were you able to actually get at the bits of a pointer? I thought
> this wasn't possible in F90/F95 --- transfer on a POINTER type acts on
> the target of that type, yes?

Yes, but the "usual" trick works. I alluded to it briefly, but didn't
spell it out. Make a derived type that looks like

  type whatever_ptr_type
    type(whatever_type), pointer :: ptr
  end type

This kind of wrapper type allows you to do several things that you
can't directly do with a pointer. The most common case is wanting
arrays of pointers (as distinct from pointers to arrays). For the
current discussion, it allows you to do

  type(whatever_ptr_type) :: whatever_ptr
  ...
  transfer(whatever_ptr,...)

which does the trick.

But don't try this particular variant at home, particularly if your
compiler does garbage collection. :-(

-- 
Richard Maine                       |  Good judgment comes from experience;
email: my first.last at org.domain  |  experience comes from bad judgment.
org: nasa, domain: gov              |        -- Mark Twain

Loading