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 9 2007, 2:20 pm
Newsgroups: comp.lang.fortran
From: "James Giles" <jamesgi...@worldnet.att.net>
Date: Mon, 09 Apr 2007 18:20:05 GMT
Local: Mon, Apr 9 2007 2:20 pm
Subject: Re: Transfer and variables that don't use all their storage space.
Richard Maine wrote:

...

> I need to use a temp variable to get the effect. First, I claim that
> introducing an intermediate variable cannot change the standard's
> claim that transfer((transfer(e,d),e) must return E.  If that made a
> difference, then that would mean that the result of transfer was
> somehow not captured in its value. [...

What's "not captured in its value" mean?  TRANSFER operates
on representations, not values.

> ...]                                 In particular, if we change it to

>   d = transfer(e,d)
>   now use transfer(d,e)

Assignments operate on values, not internal representations.
Unless the rules of assignment are *required* to preserve the
internal representation, there's no reason to expect this to work.
For many types, like INTEGER for example, there's no reason
that assignment wouldn't preserve internal representation as well
as value (there's usually only one representation of any particular
value).  But, the standard doesn't *require* the internal representation
to be preserved.  The description of TRANSFER doesn't claim that
an intermediate assignment would preserve the identity in question.
It doesn't mention assignments at all.

...

> This is for a case where D is of a "benign" type where the assignment
> operator doesn't do anything "odd".

> So do

>   d = transfer(e,d)
>   call sub(transfer(d,ee),e)

> where ee is another vairiable of the same type as e. I probably don't
> even need it, but I use it to remove any question that the first
> argument might have any reference to e. Now in the subroutine

>   subroutine sub(ee,e)

Let's rephrase this.  Suppose P and Q are pointers to the type of
E.  And suppose somewhere in the program you wrote:

   P => E

And suppose elsewhere you write:

   Q => P

and the elsewhere you write

   call sub(Q, E)

If SUB doesn't define, redefine, or cause to become undefined either
of its arguments, this is still safe.  Otherwise you're in violation of
the aliasing rule.  But that's the same rule you'd violate with your use
of TRANSFER.  So, it's not TRANSFER the introduces any potential
difficulty you see here, it's our old nemesis aliasing.  The fact that
you've gone through contortions to prevent the compiler from actually
detecting the aliased value doesn't change that.

> [...]        In particular, the actual arguments
> aren't associated in any way acknowledged by the standard, so the
> prohibitions against changing the values of the dummies don't apply.

Now you've *got* to be kidding!  Under your hypothesis (that the
intervening assignment doesn't change internal representations) they
both refer to the same underlying entities.  The rule about aliasing
don't say anything about the entities being associated in *acknowledged*
ways!  If you change the entity, you can only reference the entity through
that one dummy argument.  That's regardless of how the entities are
associated.  The word "associated" isn't even used!

>> For
>> all we know, someone in the F90 committee carefully thought
>> through all possible cases and found no "havoc" arising from
>> any of them.

> You have *GOT* to be kidding. :-) Yes, I saw that you labelled it as
> speculation. But I don't even think it is very plausible speculation.

Well, given the shallow analysis so far in this thread, it's certainly
*very* plausible that F8x people pursued it much further that we
have.  There were lots more of them and they tended to be more
zealously suspicious than the current committee seems to be.

> I've seentoo much of the committee close up; I don't think they would
> have thought through all the cases of that one, particularly as...

>> That's speculation too (unless someone remembers
>> it).  It seems as likely as that there *is* a problem with the
>> requirement that no one can identify after all these years.

> "All these years" isn't very many for allocatable components, which
> are where I can most readily see a related problem. Wouldn't surprise
> me if there are others, but that's one I think I can see concretely.

I still don't see any problem.  You have done enough hand wringing
that there *might* be a problem.  But no *new* problem has been
evident (only ones due to other violations of the standard not related
to the use of TRANSFER).  Your example still does nothing different
than CALL SUB(E, E) would do in the same circumstances.  Your
attempt to characterize it as an unacknowledged form of association
doesn't change anything.

--
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.