|
Right side comments do have value if used judiciously. In the RPG III world, I used to use right side comments in the C specs, but only for COMP, IF/END, DO/END SELEC/WHEN/ENDSL etc. groups. C DDD IFGT RPTDAY > RPTDAY C SUB 1 YY C ADD 365 DDD C END > RPTDAY I find that there is just too little room for a "real" comment, but much of the RPG III code is so monolithic that there can be hundreds or even thousands of lines between the IF and the corresponding END, so the right side comments can help there. I believe that having a mnemonic rather than a "how deep are we nested" number is more useful because sooner or later, that code will get an extra IF or have one taken out, and then the comments are out of whack with reality. Further, scanning on 0001 will turn up way too many false hits, whereas "> RPTDAY" will only find my two places. It is actually useful to add this sort of right side comment when going in to legacy code for the first time. In the RPG IV world, when I'm visiting code like that (many lines between IF and END) I have a very strong tendency to make the interior code a subroutine (with a nice long descriptive name) so that I can see the decision point and the action on the same editor screen. C DDD IFGT RPTDAY C exsr decrJulianYear C END C decrJulianYearbegsr C SUB 1 YY C ADD 365 DDD C endsr Buck Calabro Commsoft; Albany, NY Visit the Midrange archives and FAQ at http://www.midrange.com +--- | 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-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.