Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

slashed arguments in legacy fortran 1

Status
Not open for further replies.

e745200

Programmer
Feb 14, 2010
5
IT
Dealing with legacy Fortran code, I found slashed arguments in subroutines/functions definitions and references.

Does anyone remember what is this slashing for ?
I did not find anything about it in any manual I read.

Example

SUBROUTINE(A,/B/,C)
...
END SUBROUTINE

Thanks !
 
Which compiler/OS was the program written for?

When you say legacy, do you mean Fortran I, II, 66 (IV) or 77? Legacy can go back to the early 50s (earliest I've seen is late 50s).
 
At a guess, it is a call by value argument. By default, all arguments are call by reference. Basically, if the value is changed inside the subroutine, the new modified value is not returned to the calling program.

I'll check my F66 H-Fortran manuals. May be something there.
 
Just checked my 1975 Fortan IV (66) manual. I was on the right lines but the wrong way round. It says
Dummy arguments which are arrays, functions or subroutines are always transferred by location. Dummy variables are normally transferred by value but a notation is provided which makes it possible to specify that certain dummy values can be transferred by location. If the dummy value is to be transferred by location, it is preceded and followed by solidi in the subroutine, function or entry statements in which it occurs.
In
Code:
SUBROUTINE FRED(A,/B/,C)
...
B = A * C
...
END SUBROUTINE
The modified value of B is returned to the calling routine. On some compilers, this practice led to programs giving strange results when a value was put in place of the location parameter. eg

CALL FRED (A, 0, C)

This would cause the constant zero to take on the value of A*C, resulting in very strange behaviour.
 
Thanks a lot xwb, for your prompt and precise answer !

Telling the truth, I was told it might have been something related to the way arguments are passed to the called routine, but I was looking for an ultimate reference as the one you gave me. Thanks again.

The strange thing is that modern compilers tolerate such a notation (but I wonder how they deal with it ! - I will examine this issue) and nevertheless their manuals do not mention it at all (or I missed it)!

If you are interested in the issue about the different behaviors the compilers have with respect to the non standard practice of using a constant or an expression as an argument which is then modified by the called procedure, you can see the thread I opened some time ago on the intel site :
It is a big source of troubles !

Thanks again.
 
I forgot to answer your first request. Just for the sake of completeness: the code I am working on has dated comments inside starting from the mid '70s ! For sure it has been used with all the generations of compilers, from several manufacturers and on different machines since then !

And just to abuse of your kindness : do you know where can I find a pdf of the manual you cited ?
 
I just transcribed from my student edition of the Extended Fortran H manual. I'll have a look - there may be a pdf reference somewhere.
 
At a guess, it is an extension that many vendors put in. On the Intel compiler this has been replaced by %LOC().
 
I was wrong in my post above, saying that modern compilers tolerate slashed dummy arguments.

In did not noticed that in the environment I am working in, a pre-processing step removes those slashes for the currently used compilers, perhaps leaving them in place when using some specific (old) compiler.

This should confirm that that notation should be a non-standard extension of some old compiler.
 
I finally found the desired manual.
At page I found this reference :

IBM System 360 and System 370 FORTRAN IV Language, 1974.

which can be found here :

Starting at page 105, the issue of the slashed arguments is dealth with in depth. The shading of the text tells that this is an IBM extension to ANS FORTRAN, as explained at pag 11.


Well. Thanks to xwb for the hint.
I think the issue is closed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top