Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29253 Discussions

Old Code Forward Slashes in Subroutine Argument List?

chauvjo
Novice
1,224 Views
I am porting a old VM F66 code and have encountered the following subroutine. Can someone explain the purpose of the forward slashes in the subroutine definition?

Thanks,

John

SUBROUTINE SETUP (/MAGIN/,/MAGOUT/,TIC,STEP,/NEQNS/,/DTAU/,/EPSIL/

1,/DELTA/,ERR,/TIME/,/DTIME/,YICS,YPRED,YCORR,YDOT,YNEW

2 ,YDERV, YDEV,FWDEL,BKDEL,TBDEL,PARTY,YNEWB)

DIMENSION YICS( 1),YPRED( 1),YCORR( 1), YDOT( 1), YNEW( 1),

1 YDERV( 1), YDEV( 1),FWDEL( 1),BKDEL( 1),TBDEL( 1),

2 PARTY( 1),YNEWB( 1), ERR( 1)

DIMENSION C(3),D(3)

DOUBLE PRECISION YNEW,YPRED,YDERV

DATA C,D / .5,.5,1.0,.5,.0,.5/

0 Kudos
6 Replies
bmchenry
New Contributor II
1,224 Views
ahhh...ole ANSI 66 code...mainframes...JCL...back in the daze...so much FUN!
slashes are for indicating 'pass by value' v 'pass by location'
slashes around an argument is to pass 'the actual argument'v pass the value of the argument
kinda like a pointer back in the day.
that all is if i disremember correctly :-)
0 Kudos
chauvjo
Novice
1,224 Views

Thanks for the reply. So what would be the recommended method of passing by value using modern Fortran?

0 Kudos
netphilou31
New Contributor III
1,224 Views
One way could be to declare the arguments passing convention using a :
[fortran]!DEC$ ATTRIBUTES VALUE :: [/fortran]
statement and to create an interface definition in the calling program, or to manely pass the arguments by values at call time, using the %VAL(arg) directive, like:
[fortran]call SETUP(%VAL(arg1),%VAL(arg2,...)[/fortran]
Phil.
0 Kudos
Steven_L_Intel1
Employee
1,224 Views
That must be some vendor's extension - it is not part of the official ANSI standard FORTRAN 66. The VALUE attribute will work for dummy arguments, and use %VAL(arg) when calling the routine.
0 Kudos
chauvjo
Novice
1,224 Views
Thanks Phil and Steve....I am assuming I would use either the %VAL at call time or the VALUE attribute not both.
0 Kudos
mecej4
Honored Contributor III
1,224 Views
Why? If you are converting/modernizing the old code in its entirety, and everything is in Fortran, why not go with the default linkage?

Unless the old code does nasty things such as changing the value of Pi and other constants that are passed as arguments, simply removing all those slashes surrounding subroutine/function arguments should work.

Note that %VAL is a nonstandard, if fairly common, extension.
0 Kudos
Reply