|
Actually, any loop has the potential to become endless if an ITER is placed before the code that sets the condition being tested by the DO. As these contrived examples show . . . C EVAL y = 10 C EVAL x = 0 C DOU (x > y) C ITER C EVAL x = x + 1 C ENDDO C EVAL y = 10 C EVAL x = 0 C DOW (x < y) C ITER C EVAL x = x + 1 C ENDDO neither of these loops will end. Real code will never have an unconditional ITER inside a loop but it is easy to imagine a maintenance programmer adding a conditional ITER when some condition occurs that results in x never being incremented. Oops! ITER is just a disguised GOTO and thus should be carefully considered before being discarded!! ITER is useful in many cases but then GOTO can also be useful. The current wisdom suggests that GOTO be avoided. I suggest that the impact of any branch operation must be carefully considered. These sorts of bugs (endless loops) are frequently caused by ill-considered quick fixes. And please! I don't want a heap of appends showing how ITER and LEAVE and LEAVESR etc. are contributing to cleaner code. It is far too early in the year for that sort of drivel, and it just ends up being a series of opinion pieces and the only opinion that matters is mine :) Regards, Simon Coulter. -------------------------------------------------------------------- FlyByNight Software AS/400 Technical Specialists http://www.flybynight.com.au/ Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 /"\ Fax: +61 3 9419 0175 mailto: shc@flybynight.com.au \ / X ASCII Ribbon campaign against HTML E-Mail / \ --------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.
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.