On 29/01/2009, at 7:05 AM, Douglas Handy wrote:

Note that a service program is the same as an internal subprocedure in this
regard. It is a prototyped call to an external program (not *SRVPGM) which
I believe will not enforce the CONST checking.

It will as long as the called program also specifies CONST.

CONST in a prototype used by the caller has no real effect. It's documentation only although it does allow the compiler to use temporary variables to handle type conversions. However in the callee (i.e., the one with both a PR and a PI) the compiler will do its best to enforce the "CONSTness" (yuck) of the variable.

Problems only arise when, say, someone modifies the caller and thinks "I'll prototype that external call" and specifies CONST on all the supposedly input-only parameters but does not modify the callee to honour the same behaviour. In this case the callee does not know it should not change the parameter variable (and no information was provided to the compiler so it did not verify) so a change in the callee will be visible in the caller (as long as the compiler did not generate a temporary in the caller).

Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------




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.