|
> From: sjl <sjl_abc@xxxxxxxxxxx>
> I have this page bookmarked:
> http://www.web400.com/download/ilerpg/subprocedure_parameters2.htm>
Jeff Young wrote:
Based on that info, CONST is enforced by the compiler ONLY if you are using sub-procedures.
If you are using an external service program or just another program, then using VALUE is the only way to ensure that the parameter will not be changed on return from the call.
Is this a correct summary?
Not exactly. It's more correct to say that CONST is only enforced if
the called code uses a prototype to describe its parameters. Of course,
prototype mismatches can throw a wrench in things, but that's what /copy
is for.
Programs cannot receive parameters by value, at least up to V5R4. I
don't know if the user-defined entry procedure feature in V6R1 changes that.
David Gibbs wrote:
> IIRC, it won't even let you get the address of a parameter passed as
> const (using %addr), so you can't do direct memory manipulation via a
> pointer.
Nor can you pass it to a program or procedure that does not specify
CONST or VALUE, even if you use CALL+PARM.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
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.