× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Barbara,
 
There must be something that I'm missing here.  Once the "large" return value is copied to the local storage of the caller why wouldn't the storage associated with the temporary copy be immediately freed?  I don't know (not to say there isn't, just that I don't know it) of any way to re-access the return value of a function (without rerunning the function), so I don't see any value in retaining the temporary copy.  And if it's freed we shouldn't need to worry about the quantity of function calls adversely impacting the storage available for other, subsequent, work.
 
I changed the subject line as this thread has moved from an original posting with several problems to postings related to not prototyping the return value to postings related to use of "large" return values and the implications of doing so.  I know I'm beginning to get confused on which exact scenario a given note might be discussing lol

Bruce
Bruce Vining Services
507-206-4178

--- On Thu, 11/27/08, Barbara Morris <bmorris@xxxxxxxxxx> wrote:

From: Barbara Morris <bmorris@xxxxxxxxxx>
Subject: Re: Calling C from RPG: what am I doing wrong?
To: rpg400-l@xxxxxxxxxxxx
Date: Thursday, November 27, 2008, 7:47 PM

Nathan Andelin wrote:
Barbara eventually explained that this was an unavoidable
consequence of the code the compiler generates to handle varying
length return values, from which I concluded that such procedures
were potentially a bad practice.

Is this only with "large" return values? What about procedures
that
return say a 50 byte description [trimmed]?

desc = codeDesc(code);


The problem is proportional to the size of the return value. Calling a
procedure that returns 50 bytes should not be a problem unless you call
it a zillion times in the same procedure.

The problem isn't particularly related to varying-length return values.
There is some additional automatic storage required for a call to a
procedure returning a value (probably not integer or float return
values, though, unless they are arrays).

Varying-length return values are an issue because it seems like they
should only have to return the actual returned length, but actually they
have to return the prototype-defined length.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.