On 2012/4/13 1:05 PM, Alan Addison wrote:
Another option is to check if the address of the parameter is *Null or not.

If %addr(optional1)<> *Null;
....

That only works for testing a *OMIT parameter.

If it's both *NOPASS and *OMIT:

if %parms >= %parmnum(optional1)
and %addr(optional1) <> *null;
ok, use the parm
endif;

There's no guarantee that the address is null when a parameter is not passed. If it's a CONST parameter, the danger is that you would use garbage in your program. If it's a reference parameter, the danger is that you would illegally modify the storage for whatever pointer happened to be there when you checked %addr. This could cause any number of bizarre or dangerous things to happen, sometimes long after your program has returned.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].