There is another benefit to using const over value: if you define a
parameter as value, the compiler will allow code to change its value. With
const, you cannot change the value of the parameter variable once it has
come in to the procedure.

What's the big deal, you ask? First, using const will preserve the original
parameter values, which can be very handy at times. Second, if you use
*nopass a lot, you can cause troubles by using the passed in parameter if it
was not in fact passed in to the procedure. By using const, the compiler
will help protect you against this to an extent by preventing you from
changing the variable. Yes, the non-passed variable can still be (mis)used,
but at least you get a little help using const.

What I do instead is define all the parms as const, and then have supporting
variables in the procedure with default values. I then set the supporting
field values accordingly if the parameter was sent. Then in the rest of the
procedure, I only use the supporting parameters. This is also a good
approach for *omit parms. There is an example of this in this article:
http://www.itjungle.com/fhg/fhg010505-story02.html

I hope this is somehow helpful.


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.