- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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/
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 :-)
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 :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply. So what would be the recommended method of passing by value using modern Fortran?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Phil and Steve....I am assuming I would use either the %VAL at call time or the VALUE attribute not both.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page