Re: code comments and code maintainability

2012-02-16 Thread Bill Fairchild
. That's what enlightened self-interest is all about. Bill Fairchild -Original Message- From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On Behalf Of Dave Cole Sent: Thursday, February 16, 2012 4:07 AM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: code comments

Re: code comments and code maintainability

2012-02-16 Thread Chris Craddock
Bill writes: I try very hard to put a cogent comment on each machine instruction and all USINGs and DROPs. And I add a paragraph or two at the beginning of small subroutines. I do this for two reasons: (1) I have spent a lot of time studying other people's code with either poor or no

Re: code comments and code maintainability

2012-02-16 Thread Rob van der Heij
On Thu, Feb 16, 2012 at 11:02 PM, Bodoh John Robert john.robert.bo...@irs.gov wrote: I agree completely. Why doesn't the rest of the world agree and adhere to this philosophy? I don't think the disagreement is about that. As stated, the goal is to have *relevant* comments in the code.

Re: code comments

2012-02-13 Thread Bernd Oppolzer
Sorry, should have been ... less than or equal to 256 ... Kind regards Bernd Am 13.02.2012 00:08, schrieb Steve Smith: There seems to be a common misconception that MVC can't move 256 bytes. It certainly can. It cannot move zero bytes, but that's not much of a limitation. On 2/12/2012 17:45,

Re: code comments

2012-02-13 Thread Peter Relson
Some of this discussion revolves around what the base knowledge is that you expect/require that the code's readers have. If everyone understands that SR regx,regx and XR regx,regx zero regx then there is little to no benefit to having a macro that is ZERO regx. Drawing the line in the right

Re: code comments

2012-02-13 Thread robin
From: Steve Smith sasd...@gmail.com Date: Monday, 13 February 2012 10:13 There seems to be a common misconception that MVC can't move 256 bytes. It certainly can. It cannot move zero bytes, but that's not much of a limitation. Not from me. I explicitly mentioned 256. Length field 0

Re: code comments

2012-02-13 Thread robin
From: Peter Relson rel...@us.ibm.com To: ASSEMBLER-LIST@LISTSERV.UGA.EDU ASSEMBLER-LIST@LISTSERV.UGA.EDU Date: Tuesday, 14 February 2012 4:26 Some of this discussion revolves around what the base knowledge is that you expect/require that the code's readers have. If everyone understands that SR

Re: code comments

2012-02-13 Thread Paul Gilmartin
On 2/14/2012 3:41 PM, robin wrote: If everyone understands that SR regx,regx and XR regx,regx zero regx then there is little to no benefit to having a macro that is ZERO regx. If so, there's be little need for comments such as the example XR R5,R5zeroise R5 Something sensible like

Re: code comments

2012-02-12 Thread Bernd Oppolzer
The length in R3 was the length of a CHAR VARYING passed as a parameter, and it was tested to be positive and not zero before issuing the BCTR (was BALR, should be BCTR). In fact, I believe that BCTR Rx,0 is the most natural choice to do the length reduction by one before issuing an EXed MVC,

Re: code comments

2012-02-12 Thread robin
From: Gerhard Postpischil gerh...@valley.net Date: Sunday, 12 February 2012 13:45 On 2/12/2012 5:44 PM, robin wrote: In this case, BCTR is inappropriate, because the length can be zero, and use of SH provides the means to test for negative and to skip the MVC (or CLC). You're drawing an

Re: code comments

2012-02-12 Thread John Gilmore
Again, context is all. Bernd's point, Man muss übrigens nicht mit Kanonen auf Spatzen schießen. is well taken (Bowdlerized, it is overkill to launch a torpedo at a canoe, even if you sink it.) Still, I do have a MOVECHRS macro that optimizes, generates MVC, MVC loops, MVCLE, etc., as

Re: code comments

2012-02-12 Thread Gerhard Postpischil
On 2/13/2012 7:16 AM, robin wrote: The programming world is littered with it can't happen cases. Everyone knows Murphy's Law (If anything can go wrong, it will). But not many have heard of Robert's Law? (Even if it can't go wrong, it will.) So, even it the length were tested prior, one can't

Re: code comments

2012-02-12 Thread Paul Gilmartin
On Feb 13, 2012, at 05:16, robin wrote: The programming world is littered with it can't happen cases. Everyone knows Murphy's Law (If anything can go wrong, it will). But not many have heard of Robert's Law? (Even if it can't go wrong, it will.) So, even it the length were tested prior,

Re: code comments

2012-02-12 Thread Binyamin Dissen
On Sun, 12 Feb 2012 14:42:54 -0700 Paul Gilmartin paulgboul...@aim.com wrote: :On Feb 13, 2012, at 05:16, robin wrote: : The programming world is littered with it can't happen cases. : Everyone knows Murphy's Law (If anything can go wrong, it will). : But not many have heard of Robert's Law?

Re: code comments

2012-02-12 Thread John Gilmore
Paul Gilmartin wrote: begin snippet Hardware detection of arithmetic exceptions is a boon here. But one ISV C compiler requires that the generated code be run with fixed-point overflow interrupts disabled. Shame on the vendor! /end snippet I agree with this sentiment, but the blame must be

Re: code comments

2012-02-12 Thread Bernd Oppolzer
There was a little misunderstanding on my part; I thought that robin suggested the decrement by one should be done using a macro, which made no sense to me. Of course, a macro which does the whole VARCHAR move makes much more sense. But still: as John Gilmore pointed out, such a macro should

Re: code comments

2012-02-12 Thread Bernd Oppolzer
There was a time when even C/370 code and certain LE functions abended with 0C8, if the fixed point overflow mask bit was enabled; some LE functions and even compiler generated code tried to clear registers by arithmetic shift left !! When calling C/370 functions from PL/1 with FIXEDOVERFLOW or

Re: code comments

2012-02-12 Thread Steve Smith
There seems to be a common misconception that MVC can't move 256 bytes. It certainly can. It cannot move zero bytes, but that's not much of a limitation. On 2/12/2012 17:45, Bernd Oppolzer wrote: There was a little misunderstanding on my part; I thought that robin suggested the decrement by

Re: code comments

2012-02-11 Thread Martin Packer
...@uk.ibm.com Twitter / Facebook IDs: MartinPacker Blog: https://www.ibm.com/developerworks/mydeveloperworks/blogs/MartinPacker From: Rob van der Heij rvdh...@gmail.com To: ASSEMBLER-LIST@listserv.uga.edu, Date: 11/02/2012 12:27 Subject: Re: code comments Sent by: IBM Mainframe Assembler List ASSEMBLER

Re: code comments

2012-02-11 Thread robin
From: Dougie Lawson dl1...@gmail.com Date: Saturday, 11 February 2012 2:39 I was also taught to avoid the banal comments like XR R5,R5zeroise R5 when it's obvious that the action of that opcode is to perform that exact action. It is? ZERO 5 using a macro provides far better

Re: code comments

2012-02-11 Thread robin
From: Bernd Oppolzer bernd.oppol...@t-online.de Date: Saturday, 11 February 2012 3:36 My favourite one is: BALR R3,0 SUBTRACT 1 FROM R3 Obviously, the opcode is wrong, should be BCTR. But: it took me three months (!!!) to find the error, because I always looked at the comment - at

Re: code comments

2012-02-11 Thread Gerhard Postpischil
On 2/12/2012 5:44 PM, robin wrote: In this case, BCTR is inappropriate, because the length can be zero, and use of SH provides the means to test for negative and to skip the MVC (or CLC). You're drawing an unwarranted conclusion. It is quite possible that the length was tested earlier on in

code comments (Was: VarIabLe DD names in VSAM)

2012-02-10 Thread Tony Thigpen
Code that said: Mike told me this condition could never happen. If this abend ever happens, call John at xxx-xxx- and tell him that Mike owes him $100. Tony Thigpen -Original Message - From: Shane G Sent: 02/10/2012 06:06 AM On Fri, Feb 10th, 2012 at 9:37 PM, Sharuff Morsa3

Re: code comments

2012-02-10 Thread John Gilmore
Comments are or, better, should be of two sorts: 1) Substantial prefixed blocks of text, often several hundred lines of them, that describe what will be done and how it will be done, and explicate coding conventions for parameters, and 2) comments following single instructions, 'remarks'. For

Re: code comments (Was: VarIabLe DD names in VSAM)

2012-02-10 Thread Sam Siegel
LOL --Original Message-- From: Tony Thigpen Sender: IBM Mainframe Assembler List To: ASSEMBLER-LIST@LISTSERV.UGA.EDU ReplyTo: IBM Mainframe Assembler List Subject: code comments (Was: VarIabLe DD names in VSAM) Sent: Feb 10, 2012 3:31 AM Code that said: Mike told me this condition could

Re: code comments

2012-02-10 Thread Steve Comstock
On 2/10/2012 7:40 AM, John Gilmore wrote: Yes, indeed. I should have proofed my post. Still, the substance of what I wanted to say is not much affected by the fact that 'SR' should have been 'SM'. Or maybe 'STM' :-) On 2/10/12, John P Kalinichjkali...@csc.com wrote: John Gilmore of

Re: code comments

2012-02-10 Thread John Gilmore
I am delighted to see that my posts are read. Let's agree that it should be one of STM|STMH|STMG|STMY . On 2/10/12, Steve Comstock st...@trainersfriend.com wrote: On 2/10/2012 7:40 AM, John Gilmore wrote: Yes, indeed. I should have proofed my post. Still, the substance of what I wanted to

Re: code comments

2012-02-10 Thread Michael Stack
At 03:36 PM 2/10/2012 +, you wrote: ... I was taught at an early age to read the code rather than the comments, especially when one disagrees with the other. And I learned at an early age to look at the object code. This rule was hammered home when we purchased commercial software which

Re: code comments

2012-02-10 Thread McKown, John
-Original Message- From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On Behalf Of Michael Stack Sent: Friday, February 10, 2012 9:47 AM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: code comments At 03:36 PM 2/10/2012 +, you wrote: ... I

Re: code comments

2012-02-10 Thread Kirk Talman
IBM Mainframe Assembler List ASSEMBLER-LIST@LISTSERV.UGA.EDU wrote on 02/10/2012 10:46:35 AM: From: Michael Stack li...@kcats.org And I learned at an early age to look at the object code. This rule was hammered home when we purchased commercial software which contained such oddities as R3

Re: code comments

2012-02-10 Thread John Gilmore
Dougie Lawson wrote: | It's more fun when you find a comment that's meaningless | like SR R5,R5 Store register 5. He and I have disagreed (though not of course about IMS, about which I defer reflexively to his judgment); but he is a lot smarter, less literal-minded than many of you. On 2/10/12,

Re: code comments

2012-02-10 Thread Martin Packer
And I'm leery of symbol names. For the same reasons we've all outlined: They lie/misdirect/are vague. Martin Martin Packer, Mainframe Performance Consultant, zChampion Worldwide Banking Center of Excellence, IBM +44-7802-245-584 email: martin_pac...@uk.ibm.com Twitter / Facebook IDs:

Re: code comments

2012-02-10 Thread Bernd Oppolzer
My favourite one is: BALR R3,0 SUBTRACT 1 FROM R3 Obviously, the opcode is wrong, should be BCTR. But: it took me three months (!!!) to find the error, because I always looked at the comment - at least 20 times - and never realized that the operation did something totally different

Re: code comments

2012-02-10 Thread David P de Jongh
I think a large part of the problem is that kids are not taught to think. There was a classicFar Side cartoon many years ago called "Billy's Nightmare" or similar, where the littleguy is in a library where every book is called "The big book of story problems", "The story problem anthology",

Re: code comments

2012-02-10 Thread Bernd Oppolzer
I believe like John that written coding standards - without a respected and accepted person who enforces these standards and is capable (and has time) to talk, teach and explain to the coders why the standards are useful etc. - do no good. I once met a guy who had such a job. He has now

OT: Teaching and Learning was RE: code comments

2012-02-10 Thread Dave
: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] On Behalf Of David P de Jongh Sent: 10 February 2012 18:05 To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: code comments I think a large part of the problem is that kids are not taught to think. There was a classic Far Side

Re: code comments

2012-02-10 Thread John Gilmore
Bill Fairchild's |fourteen equ 14 is a convenient vehicle for making an important point. A device that is appropriate in the hands of a knowledgeable and experienced person may well be misused by someone who is neither. This is obvious, but what to do? One now very common notion of what to