Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Transfer and variables that don't use all their storage space.
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Richard Maine  
View profile  
 More options Apr 9 2007, 12:12 am
Newsgroups: comp.lang.fortran
From: nos...@see.signature (Richard Maine)
Date: Sun, 8 Apr 2007 21:12:04 -0700
Local: Mon, Apr 9 2007 12:12 am
Subject: Re: Transfer and variables that don't use all their storage space.

James Giles <jamesgi...@worldnet.att.net> wrote:
> Richard Maine wrote:
> > Brooks Moses <bmoses-nos...@cits1.stanford.edu> wrote:
> ...
> >> The Fortran 2003 standard states that TRANSFER(TRANSFER(E,D),E)
> >> should result in E, if D and E are scalar variables and the physical
> >> representation of D is as long as or longer than that of E.  (Section
> >> 13.7.121, lines 30-32.)

> > That's one part I'm sure is inconsistent. That can't realistically be
> > expected to work in all cases. I think that whoever wrote those words
> > just didn't think of the edge cases at all. Consider a scalar of a
> > type that has allocatable components (perhaps multiple of them, at
> > multiple depths). I really don't think that the standard envisions
> > going through and doing all the allocations that would be needed to
> > make that work; and I sure don't know what the intermediate bits
> > would be.

> The internal representation of ALLOCATABLE components
> of a derived type would almost certainly be very similar to the
> internal representation of a POINTER component....
> What TRANSFER would
> operate on would be the implementation dependent bits of
> such a hidden descriptor.

Yes, that's what I would expect. *HOWEVER*, if you transfer the bits of
such a descriptor that is allocated, you are likely to end up with two
different allocated allocatables trying to use the same storage. That is
certainly not envisioned and is likely to cause havoc. A straightforward
reading of the words that Brooks cited above seems to suggest that it
ought to work, since the resulting variable is claimed to have the same
value as the original. That's the kind of situation I'm envisioning, and
I think the cited words of the standard completely fall apart for cases
like that.

Yes, I can imagine what I'd expect to happen in practice, based on
transfer just copying the bits, and I can imagine people trying to take
advantage of that for system-dependent stuff. No debate there. I'm
talking purely about standard-conforming code, and code that the
standard claims ought to be portable as well by the above citation.

--
Richard Maine                    | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle           |  -- Mark Twain


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.