sparge
Joined: 11 Apr 2005 Posts: 371
|
Posted: Mon Jun 20, 2005 7:23 am Post subject: select_graphics_object@ |
|
|
Just investigating a mysterious problem with code that has been (apparently) working fine for some years, and found my way to this line:
call select_graphics_object@ (hangra)
Stepping through the code, I found that two of the four values returned by a subsequent call to get_graphics_selected area@ were garbage. This prompted me to check the user manual, where I found that select_graphics_object@ is apparently a function, not a subroutine. Prompting (at least) two questions:
Am I right in that it was once a subroutine, and that the definition has been changed at some point? Even if I'm wrong and it was always a function, why doesn't the compiler pick up my attempt to use it as a subroutine?
Confused and potentially vexed,
Andy |
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Tue Jun 21, 2005 1:34 am Post subject: select_graphics_object@ |
|
|
select_graphics_object@ has always been a function but FTN95 allows you to call it as a subroutine.
The argument is a user-supplied integer that identifies a given %gr region.
As a general rule a Fortran compiler does not know if an external subprogram is a function or a subroutine. At best it can only check that your usage is consistent (similarly for the number and types of its arguments). In the present case the routine is given an interface in a header file so perhaps a check for function/subroutine usage could be made. However, there are obviously cases where one is not interested in the value returned by a function and it is convenient to be able to call it as a subroutine.
Regards
|
|