soccer jersey forums.silverfrost.com :: View topic - Please add function result to list of variables
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 

Please add function result to list of variables

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit
View previous topic :: View next topic  
Author Message
mecej4



Joined: 31 Oct 2006
Posts: 1896

PostPosted: Sun Mar 05, 2023 2:33 pm    Post subject: Please add function result to list of variables Reply with quote

Inside the body of a non-recursive function, the name of the function may be used as an ordinary variable in expressions, I/O lists, etc. In some codes such as SLATEC, there are functions in which the result variable is used and updated several times in the body of the function before returning from the function. Other Fortran symbolic debuggers (VS+Ifort, Absoft+FX2, for example) include the function name in the list of variables whose values may be seen in a Variables pane, or by hovering the mouse on the variable. SDBG does not do so.

Here is an example that may clarify the issue. Run it in SDBG/SDBG64 and try to observe what is going on in the subroutine. Notice that the return variable FIB is updated several times inside the function, which is entered only once, but we are unable to observe the changes in the value of FIB.

Code:
program tfibonacci
  implicit none
  print *,fib(10)

contains

   integer function fib(n)   ! not recursive
      integer n, sp, spp, i
      if (n < 3) then
         fib = n-1
         return
      endif
      spp = 0
      sp  = 1
      do i = 3, n
         fib  = spp + sp
         spp = sp
         sp  = fib
      end do
      return
   end function fib

end program tfibonacci
Back to top
View user's profile Send private message
Robert



Joined: 29 Nov 2006
Posts: 450
Location: Manchester

PostPosted: Sun Mar 05, 2023 6:25 pm    Post subject: Reply with quote

I will look into it
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit 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