- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes - never use subroutines. Personally I'd find that rather limiting.
Why do you ask?
Why do you ask?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
Subroutine (and call) in Fortran is equivalent to (void) function in C.
So if you don't want to use call, change your subroutines to integer functions returning 0.
SO
CALL my_subroutine(...)
will become
idum=my_function(...)
What is the benefit?
Subroutine (and call) in Fortran is equivalent to (void) function in C.
So if you don't want to use call, change your subroutines to integer functions returning 0.
SO
CALL my_subroutine(...)
will become
idum=my_function(...)
What is the benefit?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes.
Use only FUNCTION invocations or, if that is too similar to a SUBROUTINE call to meet your criteria, use GOTO (or, equivalently, if your compiler allows it, COMEFROM) and possibly, SENSE LIGHTs.
It will be stimulating to debug large programs written this way.
That's how things were in FORTRAN I.
Use only FUNCTION invocations or, if that is too similar to a SUBROUTINE call to meet your criteria, use GOTO (or, equivalently, if your compiler allows it, COMEFROM) and possibly, SENSE LIGHTs.
It will be stimulating to debug large programs written this way.
That's how things were in FORTRAN I.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, I remember everything but the Calls....yuck.
Renee
Renee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi renee,
when we migrated from CVF, we had to fix probably a thousand CALLs. IVF seems very picky - a subroutine declared with a local prototype that returns a value must indeed return a value, and a subroutine with no function prototype must use CALL. It would have been nice to be able to turn this off, but it was not a big deal firstly because it is a compilation (not runtime) error, and secondly because we could fix these in the CVF baseline prior to the port.
- jeremy
when we migrated from CVF, we had to fix probably a thousand CALLs. IVF seems very picky - a subroutine declared with a local prototype that returns a value must indeed return a value, and a subroutine with no function prototype must use CALL. It would have been nice to be able to turn this off, but it was not a big deal firstly because it is a compilation (not runtime) error, and secondly because we could fix these in the CVF baseline prior to the port.
- jeremy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, CVF would sometimes let you get away with CALLing a function, when it thought there was no harm. It turned out that the cases where you could get away with this were fewer than we thought and in the end we decided to just ban the whole thing (which is not legal Fortran in the first place). There were problems with corrupting floating point stacks and worse.

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