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



Hi Bob -

On Mon, 7 May 2007 13:16:08 -0500, "Bob Cozzi" <bob@xxxxxxxxxxxx>
wrote:

CONST parms can't be changed by the called subprocedure, unless as Joe
explained
there is some subversion going on. But even then, if I recall correctly, there
is in fact a runtime error that will occur if you pull the address-of the const
and try to modify it. OS/400 pointers are very secure.

That's true only if the subprocedure is compiled with CONST on the PI.
If the subprocedure is compiled using a PR and PI without CONST, there
are no restrictions on changing the parameter because the compiler has
no way to know that the caller will be using a prototype with CONST.
Nor is there any run-time mechanism to detect the mis-match.

The stack thing is all academic--it doesn't really occur that way on real
computers like System i. Sure its simulated but at the end of the day, just a
pointer is passed by reference, not the value. Sure some things are put into
registers, but even VALUE parameters are passed by reference under the covers.
(Correctly if I'm wrong about this; if I am, I'm sure someone will.)

You're wrong about this. Parameters passed with VALUE have the actual
parameter placed in the call parameter list where a pointer would be
placed for a parameter passed by reference.

Ken
http://www.kensims.net/
Opinions expressed are my own and do not necessarily represent the views
of my employer or anyone in their right mind.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.