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



This is a style issue, and I think you're going to get some argument. <g>

In my first C class in junior college, the instructor gave us expressions
like this to evaluate on tests.  When I asked him about some of the
convoluted stuff (much more obscure than these loop control statements) he
threw at us he said something to the effect that a lot of people write code
like this and you'll lose if you can't read it.  He especially liked things
that combined multiple levels of indirection with blurring the distinction
between logic and arithmetic.

As a matter of personal taste, I don't care to write code like that, but I
can understand how someone would. I don't think it usually has anything to
do with job security--just a desire to cram as much as possible into as
little space as you can.

-----Original Message-----
From: Joe Pluta [mailto:joepluta@PlutaBrothers.com]
Sent: Thursday, April 18, 2002 4:59 PM
To: rpg400-l@midrange.com
Subject: RE: convert this code


> From: James Rich
>
>   for (i = 0; ((line[i] == stop) && (line[i]));)
>  (...)
>   for (x = 0; ((line[x]) && (line[x] != stop)); x++)

This is bad code.  It's called "for abuse", and is pretty unanimously
condemned.  Converting this to RPG is just asking for problems.

I heartily recommend Carel's advice to just use SCAN.

Joe

_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.