|
|
Up |
  |
Author: John HarperJohn Harper Date: Nov 13, 2007 15:09
In an attempt to understand pointers, I wrote the following:
PROGRAM testassoc3
INTEGER, TARGET :: beast = 666
INTEGER, POINTER :: ptr => NULL()
ALLOCATE(ptr)
ptr = beast
PRINT "(A,I4)",' After ptr = beast, ptr is',ptr
PRINT "(A,L2)",' associated(ptr,beast) is',associated(ptr,beast)
PRINT "(A,L2)",' associated(ptr) is',associated(ptr)
END PROGRAM testassoc3
The output from four different f95 compilers was
After ptr = beast, ptr is 666
associated(ptr,beast) is F
associated(ptr) is T
That appears to suggest that ptr was associated with something at the
time of printing, but not with beast even though its value was that
of beast. What was ptr associated with?
|
| Show full article (0.92Kb) |
| 5 Comments |
|
  |
Author: glen herrmannsfeldtglen herrmannsfeldt Date: Nov 13, 2007 16:16
John Harper wrote:
> PROGRAM testassoc3
> INTEGER, TARGET :: beast = 666
beast has value 666 and may be the target of a pointer
> INTEGER, POINTER :: ptr => NULL()
> ALLOCATE(ptr)
A new variable is allocated, pointed to by ptr.
> ptr = beast
The value of beast is copied to the variable pointed
to by ptr.
> PRINT "(A,I4)",' After ptr = beast, ptr is',ptr
> PRINT "(A,L2)",' associated(ptr,beast) is',associated(ptr,beast)
> PRINT "(A,L2)",' associated(ptr) is',associated(ptr)
ptr and beast point to different variables, so are not associated.
|
| Show full article (0.93Kb) |
| no comments |
|
  |
|
|
  |
Author: jtravsjtravs Date: Nov 14, 2007 11:35
On Nov 14, 12:18 am, nos...@see.signature (Richard Maine) wrote:
> I'll get it down in a more permanent form. From the Fortran 2003
> Handbook (no, you can't buy it yet - this is a sneak preview):
Hi, this is the first I have heard of the Fortran 2003 Handbook. I
presume it's a book by you? Out of interest do you have a plan of when
it might be available? I'd very much like to get a copy.
Best regards,
John
|
| |
| no comments |
|
  |
Author: Paul van DelstPaul van Delst Date: Nov 14, 2007 12:23
jtravs wrote:
> On Nov 14, 12:18 am, nos...@see.signature (Richard Maine) wrote:
>> I'll get it down in a more permanent form. From the Fortran 2003
>> Handbook (no, you can't buy it yet - this is a sneak preview):
>
> Hi, this is the first I have heard of the Fortran 2003 Handbook. I
> presume it's a book by you? Out of interest do you have a plan of when
> it might be available? I'd very much like to get a copy.
|
| |
| no comments |
|
  |
Author: nospamnospam Date: Nov 14, 2007 15:37
jtravs gmail.com> wrote:
> On Nov 14, 12:18 am, nos...@see.signature (Richard Maine) wrote:
>> I'll get it down in a more permanent form. From the Fortran 2003
>> Handbook (no, you can't buy it yet - this is a sneak preview):
>
> Hi, this is the first I have heard of the Fortran 2003 Handbook. I
> presume it's a book by you? Out of interest do you have a plan of when
> it might be available? I'd very much like to get a copy.
Springer says May. And I think we are actually on schedule (the current
one). It's been slow. :-(
The writing is done. Just needs final editing, index, and then whatever
Springer does to get it out the door.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
|
| |
| no comments |
|
|