forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Subroutine Arguments

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
Anonymous
Guest





PostPosted: Wed Mar 30, 2005 6:06 am    Post subject: Subroutine Arguments Reply with quote

Hi, I am trying to compile some Legacy Fortran Code I have been given, I believe it is Fortran 77. I am new to Fortran and have searched all I can to resolve this issue, but with no luck!
I am getting compiler errors saying I am passing the incorrect number of arguments

Declaration example:

SUBROUTINE TEST (PARA1, PARA2, PARA3, PARA4, *)

I believe the problem is related to the last argument, as you can see it contains a '*', I can only assume that this is some sort of optional parameter, but I cant get the code to compile. The number of argument calls to the routine do vary and sometimes, use '*9999' as a passing value for the last argument, strange!
If this a non-standard feature?

Any help would be appreciated


Julian
Back to top
ursuselasticus



Joined: 26 Mar 2005
Posts: 43

PostPosted: Wed Mar 30, 2005 11:14 am    Post subject: Subroutine Arguments Reply with quote

Well Julian,

I do not know about the usage of this asterisk argument. But the basic rquirements is that the number of arguments in the call must be the same as the number of dummy arguments in the subroutine.

So I would check the code of the subroutine to look at the list of dummies:

- check the number of arguments
- check type of arguments, but observe the default type of variables starting with i,j,k,l,m,n is integer!
Best regards

Norbert
Back to top
View user's profile Send private message
Anonymous
Guest





PostPosted: Wed Mar 30, 2005 12:27 pm    Post subject: Subroutine Arguments Reply with quote

Thank you for your reply Norbert, I have today found out what this code means from some forums:

This is called alternate return from a subroutine. The
subroutine can use a RETURN 1 statement to return, in your
example, to statement 9999 in the calling program, instead of
the statement after the call. (Multiple *, multiple return
points, and an integer expression larger than 1, also.)

and:

Ah. Yes it was in f77. See 15.6.2.3(6) of the f77 standard. It
certainly wasn't added since f95. Quite the opposite - it was made
obsolescent in f90. It is more on the way out than in (though some
debate whether it should be).

Interesting!

Now I must check for compiler options to see if I can get round this problem!

Julian
Back to top
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group