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
 
glen herrmannsfeldt  
View profile  
 More options Apr 9 2007, 3:55 pm
Newsgroups: comp.lang.fortran
From: glen herrmannsfeldt <g...@ugcs.caltech.edu>
Date: Mon, 09 Apr 2007 11:55:30 -0800
Local: Mon, Apr 9 2007 3:55 pm
Subject: Re: Transfer and variables that don't use all their storage space.

Richard Maine wrote:

(snip)

> In some senses, I'm not sure this is as good an example of problems as
> the allocatable one. But this is one that I actually got bit (um, pun
> not intended, or even noticed until I reread this) by in the early 90's.
> It is what made me start thinking about the possibility of cases where
> just naively copying the bits might not have the effect of copying all
> the information correctly. One example that occurred to me (but I don't
> think I've seen) would be relative addressing of pointers. If you have
> relative addressing, then copying the same bits to another location
> doesn't preserve their meaning.

There is an old trick of to save memory for doubly linked lists,
I believe sometimes used in C programs.  Instead of storing the
two pointers (next and previous list element) you instead store
the exclusive OR of the two.  In traversing the list, you know where
you are coming from, exclusive OR that with the stored value gives
the pointer to the next element.   I would probably use the difference
instead, but then you need to know which direction you are going.

Neither are legal in standard C.  Pointer comparison and subtraction
are only allowed on pointers to the same object, such as different
array element.  A pointer difference chain would be legal within an
array, but not for separately allocated elements.

Assuming relative pointers are legal Fortran, it would seem to
exclude bit copying.

-- glen


 
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.