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



On Thu, 2005-07-28 at 13:38, Joe Pluta wrote:
> How about you?  Do you use update capable parameters?  If so, is there a
> way (other than the prototype itself, obviously) that you make sure the
> caller knows that a given field is changed by the procedure?  The reason
> I say other than the prototype is because there are performance
> considerations when using VALUE and CONST.  I'm just wondering how often
> people use bidirectional parms, and how they keep it straight.  It would
> seem to me that this could be a possibility for nightmarish bugs.
> Imagine somebody changing a pointer parameter?

Very, very rarely will I use a reference parameter.  I almost did it for
my "getTokens()" procedure (
http://www.rpgnext.com/docs/rnbstring/xRPG_procedures_getTokens.php )
because I really needed it to return the number of tokens AND the array
of tokens.  I eventually opted for a pointer to the array instead, which
I pass by CONST (so it can't be changed).

One thing I never liked about dynamic call was that a parm could be
unintentionally changed in the calling program.   Let's say I have to
send 5 parms, the first 4 of which are all used to determine the desired
output of parm5.  If the calling program actually uses parm3 as a
variable and changes its value (say converting a lower case switch to
upper case), then that value has now been changed in my calling
program.  I just don't like the uncertainty, so I almost always pass
parms using CONST, which will protect both my calling procedure and
ensure the integrity of the variable in my sub-procedure.

Also, in the above example, I'm probably passing a blank/0 value
variable  just so I can have a place holder for the return:

<code>
// like this
rtnVal = myProc( parm1 : parm2 : parm3 : parm4 );

// not this...
myProc( parm1 : parm2 : parm3 : parm4 : parm5 );
rtnVal = parm5 ;
</code>

I suppose you could argue that I could have just passed "rtnVal", but
there could easily be a bunch of reasons not to do that as well.   This
example is obviously trivial.  And I know I'm probably preaching to the
choir, but you did ask :-)

Joel Cochran
http://www.rpgnext.com



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.