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



On Thu, 2003-10-02 at 12:41, Hans Boldt wrote:
> Just to add to the very good points already listed:

Thanks :-)

> For structured statements, the ENDxx should be aligned with the 
> corresponding IF, DOU, DOW, etc. The statements between are the ones 
> indented. (My own preference is 3 spaces.) For example:
> 
>        if found;
>           limit = previous - 4;
>           for i = 1 to limit;
>              process_item (i);
>           endfor;
>        endif;

Absolutely, me too...

> For continued statements, the continuation should also be indented 
> some additional amount, and each continued line should be indented 
> the same amount. Unlike Joel, I don't see any problem with 
> continuing for more than two lines. Indeed, if a procedure has 
> several parameters, and each can be an expression, it may make sense 
> to code each parameter on a separate line.

Yes, I should have been clearer: I don't necessary consider that
wrapping because the parms are contained within a procedure call.  I was
thinking more along the lines of something long and messy like this:
 /free
     myNewValue = %rem( x *  ( calcSomeValue( divisor : multiplier ) ) :
                                          godKnows( var1 * %diff( date1
: date2 : *d ) ) ) -
                               %rem( ( cos( myValue ) * PI ) :  sqrt(
sin( another ) );
 /end-free
OK, rotten example, but I hope I made my point.  One problem is
readability, the other is debug: a big statement like that becomes
troublesome to debug.  It's supposed to be a common sense rule.

> For compound logical expressions, my preference is to code each 
> sub-condition on a separate line with the logical operator at the 
> beginning of the new line. And to contradict my previous rule on 
> continued statements, I prefer *not* indenting in this case. For 
> example:
> 
>        if  found
>        and item_found <> 'junk'
>        and item_found <> 'garbage';
>            // Process valid item
>            process_item
>                  (item_found:
>                   search_code:
>                   library_name + '/' + file_name);
>        endif;

I tend to do this if the conditional statements are more complex, but if
they are simple I don't bother.

> Getting further into a coding standard, you get into things that are 
> more personal preference. But you might want to consider the following:

// Lots more great stuff deleted

At a certain point it definitely becomes preference.  Just remember when
you are writing your standard that adopting a Style has two main
purposes, consistency and consistency.

:-)

Joel
http://www.rpgnext.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.