[comp.lang.fortran] pointers in MIPS Fortran?

keinert@IASTATE.EDU (Keinert Fritz) (05/16/91)

I ran across a piece of Fortran code that uses pointers. It compiles
on the DEC f77 version 2.1 compiler (for MIPS-based DEC 2100), but
I could not find any documentation in the DEC f77 manual, nor in the
DEC VAX Fortran manual.

The declaration

	pointer (p, real)

or
	real x
	pointer  (p, x)

makes p a pointer to a real variable. You can do things like

	p = x

(p is now pointing to x),

	x = p

(assign to x the value of whatever p is pointing to), and so on.

Does anybody know where this is documented?

--
Fritz Keinert                             phone:  (515) 294-5128
Department of Mathematics                 fax:    (515) 294-5454
Iowa State University                     e-mail: keinert@iastate.edu
Ames, IA 50011

vlr@litwin.com (Vic Rice) (05/16/91)

In <1991May15.162734@IASTATE.EDU> keinert@IASTATE.EDU (Keinert Fritz) writes:

>I ran across a piece of Fortran code that uses pointers. It compiles
>on the DEC f77 version 2.1 compiler (for MIPS-based DEC 2100), but
>I could not find any documentation in the DEC f77 manual, nor in the
>DEC VAX Fortran manual.

>Does anybody know where this is documented?

Look in /usr/lib/cmplrs for the file F77V200.release_notes.

-- 
Dr. Victor L. Rice
Litwin Process Automation

seymour@milton.u.washington.edu (Richard Seymour) (05/17/91)

In article <1991May15.162734@IASTATE.EDU> keinert@IASTATE.EDU (Keinert Fritz) writes:
...about finding an undocumented "pointer(p,real)" declaration in 
>DEC f77 version 2.1 compiler (for MIPS-based DEC 2100), but
>	real x
>	pointer  (p, x)
>makes p a pointer to a real variable. You can do things like   
> p=x   (p is now pointing to x),    
> x=p  (assign to x the value of whatever p is pointing to), and so on.

although not as true-pointer-like as the above quote implies, you have
somewhat similar abilities in many DEC fortrans: both VMS and PDP-11.
In VMS fortran, creative use of the  %LOC(variable) and %VAL(variable)
in code or subroutine calls can produce pointer-like operations.
Something like:     point=%LOC(variable)
                     call foo(%VAL(point))
                     ....
                    subroutine foo(target)
                   x=target

"x" will end up receiving whatever datum was inside "variable"
and if you'd used   call foo(%VAL(point+4))
"x" would get whatever was in the longword FOLLOWING variable...

additonally, you could do   x=%REF(%VAL(point+4)) in the main program
for the same result.
--dick