× 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.



CONST and VALUE have the same goal: The passed parameter should not be
changed. CONT is there because VALUE is not supported for dynamic call
(EXTPGM keyword used in the prototype). An external program requires all
parameters to be passed by reference (page 326 in the RPG reference
manual V5R3).

So if you are not going tu use the EXTPGM keyword in the prototype,
then use VALUE and avoied CONST. Only VALUE garanties that the parameter
wont get changed in the called program.

"Alan Campin" <Alan.Campin@xxxxxxxxxxxxxxxx> 2007-05-07 13:13 >>>
<snip>
I really wish the compiler would implement a CONST_AND_I_MEAN_IT
option
i.e.
the parm is always passed by copy.
</snip>

I am confused. I thought that was exactly what VALUE meant.

CONST does not mean I guarantee this value will not be changed. Just
that I will try.

The other thing here that I have been reading that a CONST is better
than a VALUE but my understanding is that in many cases, VALUE's are
more efficient because the complier pushes the copy onto the stack and
can reference it directly off the stack.

A 4 byte integer on the stack is going to be a lot more efficient than
a
16 byte pointer on the stack referencing to memory in another program.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.