|
This is a minor optimization question. Do the bifs in the procedure call as described below execute every time the procedure is invoked in a loop? For 100 calls I'm sure it's no big deal, but the bifs in this example would return the same value every time. For a single call I agree with you completely. > -----Original Message----- > From: Jon.Paris@halinfo.it [mailto:Jon.Paris@halinfo.it] > Sent: Tuesday, December 14, 1999 7:43 AM > To: RPG400-L@midrange.com > Subject: RE: New RPG Redbook (was Sub Files).(and quick sort) > > > > > >> Here's a test program I wrote last year to play with > qsort(). Don't vouch > for the quality or style. > > Just a couple of comments to help others understand some of > the additional > potential of the functionality here. > > First the invocation of qsort can use the BIFs directly since > the parms are > passed by value - there is no need to copy the BIF result to > a variable. > > C callp sortit( %Addr(array) : numelems : > C %Size(array) : %PAddr('COMPFUNC') ) > > One of the benefits of qsort and bsearch is that they don't > have to sort/search > the whole array so the value "x" would be better than > "numelems" - although in > your example they are the same anyway <grin>. > > +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.