×
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.
There may have been discussion on this in the past but curious if
anyone knows how parameters get passed to procedures specifically.
I know that if you are passing by reference, what is pushed onto the
stack is a pointer to the value and, of course, it must be a field,
not a constant or expression.
I know that on other machines, when you pass by VALUE, the compiler
will evaluate what is being passed and decide how to pass it. For
example, if you are passing an integer, the compiler will push the
actual value on the stack. On the AS/400 people have said the AS/400
will create a temporary variable and then pass a pointer to it on the
stack. Is this always going to be true?
Will the compiler optimize how variables are passed or will it always
pass a pointer?
Obviously it is a lot more efficient to push the integer on the stack
(4 bytes) instead of creating a work variable, copy the value to it,
get a pointer and push pointer onto the stack (16 bytes) and then
throw away when done.
The other thing that I have read is that some modern compilers will
reference to the variable straight off the stack instead of popping
the value off the stack. So instead of creating a work variable in the
receiving procedure and then moving the integer to it, they just
reference the value from the stack. Again, more efficiency.
How does the RPG compiler do this?
Anybody ever see a document taking about how the RPG compiler actually
passes variables?
Thanks.
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.