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



Lim Hock-Chai wrote:

I didn't want to use varying because I though at run time it will always
allocate the max size of the field.  Another word, if caller pass only
one char to the procedure, at the time, this procedure will still
allocate 32767 byte of memory.


The compiler doesn't necessarily do a dynamic allocation of the
temporary for each call; it might reuse the same temporary for many
different purposes in your procedure.  And the compiler uses temporaries
for many more things than just parameter passing.  Whatever temporaries
it needs to convert your parameters might already be available for it to
use.  Making your procedure so complicated might not be necessary at
all.

Remember Donald Knuth's words: "Premature optimization is the root of
all evil."

Anyway, you would likely get much better run-time speed using CONST
VARYING; the code to handle the parameter is tons simpler and therefore
less error-prone.  Having to code %SUBST(parm:1:parmlen) can get pretty
annoying.  The temptation will be to store it in a varying temporary;
might as well let the compiler handle that while passing the parameter.


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.