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
 
James Giles  
View profile  
 More options Apr 8 2007, 10:45 pm
Newsgroups: comp.lang.fortran
From: "James Giles" <jamesgi...@worldnet.att.net>
Date: Mon, 09 Apr 2007 02:45:38 GMT
Local: Sun, Apr 8 2007 10:45 pm
Subject: Re: Transfer and variables that don't use all their storage space.

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.  It would
probably consist of an address field, some fields to describe
the bounds of the allocated object in each of its dimensions,
and some tags specifying status (at least one: whether the object
is allocated or not).  As such, that internal representation
probably takes up the same amount of room whether the
components are allocated or not.  What TRANSFER would
operate on would be the implementation dependent bits of
such a hidden descriptor.  People have used such tricks to
reverse engineer and then manipulate the internal representation
of POINTERs before now.

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies."   --  C. A. R. Hoare


 
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.