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 

Using centre@ function
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
mecej4



Joined: 31 Oct 2006
Posts: 792

PostPosted: Mon Jan 15, 2018 3:48 pm    Post subject: Re: Reply with quote

LitusSaxonicum wrote:
If I am right (and I concede that it is about 20 years since I last worked with Assembler, so I could be wrong), then all a FUNCTION returns is the address to its result on the stack.

The compiler writer is free to implement function calls that way, but that is not how FTN95 handles functions that return simple scalar type results (such as integer, real and double precision). For example, for functions of type INTEGER, the return value is held in AX, EAX or RAX. For functions of type real, the return value is in ST0 or XMM0. No address is needed or used, as with more general expressions.

Things were different when we had 8-bit or 16-bit computers, and a register was insufficiently large to hold Fortran integers (other than INTEGER*2 and INTEGER*1).

If such a character type function is referenced in an expression or an I/O list, the compiler may have to create a temporary variable on the stack to hold the result and pass the address or value of the temporary variable to the I/O routines.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
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