×
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.
Michael_Schutte@xxxxxxxxxxxx wrote:
Answer me this! A procedure always returns by value? You cannot return an
address?
You can return the value of a pointer... which basically is an address...
But there are several reasons why that's a bad idea:
a) The compiler can't catch mismatch errors, since the prototype doesn't
contain the data type that the pointer points to. You can pass a
pointer to the wrong data type, and it'll do nothing to save you.
b) It's tricky to keep track of who "owns" the storage the pointer
points to. Does the caller have to deallocate it? Will it be reused by
the next call to the procedure? Will the procedure deallocate it, and when?
c) Many RPG programmers dislike pointers, or aren't trained in them.
None of these things are problem when passing parameters by reference,
despite that it essentially does the same thing under the covers.
Having said that, I often do write routines that return pointers.
Usually it when I'm implementing routines that have "handles" to keep
track of multiple instances of an "object".
As an Amazon Associate we earn from qualifying purchases.
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.