[Info-vax] Listeners in VMS Basic, was: Re: Integrity iLO Configuration?
abrsvc
dansabrservices at yahoo.com
Mon Jul 12 22:24:06 EDT 2021
On Monday, July 12, 2021 at 9:29:00 PM UTC-4, Dave Froble wrote:
> On 7/12/2021 7:43 PM, abrsvc wrote:
> > On Monday, July 12, 2021 at 7:13:08 PM UTC-4, Dave Froble wrote:
> >> On 7/12/2021 4:16 PM, Stephen Hoffman wrote:
> >>> On 2021-07-09 23:45:31 +0000, Dave Froble said:
> >>>
> >>>> Just because some agree, doesn't make them right.
> >>>>
> >>>> But, Ok, a practical example, tell me, too many comments, not enough
> >>>> comments, what?
> >>>>
> >>>> ;+
> >>>> ; Base block must be > 0
> >>>> ; # of blocks must be > 0 & < 128
> >>>> ; End block must be <= EOF block
> >>>> ; Grant lock if caller has exclusive access to the file
> >>>> ;-
> >>>>
> >>>> MOVZWL #SS$_ABORT,R0 ; Assume failure
> >>>> TSTL R3 ; Base block zero?
> >>>> BNEQU 020$ ; No, continue
> >>>> 010$: BRW RETURN ; Yes, return
> >>>> 020$: TSTL R4 ; Block count zero?
> >>>> BEQLU 010$ ; Yes, return
> >>>> CMPL #127,R4 ; Block count <= 127
> >>>> BLSSU 010$ ; No, return
> >>>> MOVAB -1(R3)[R4],R5 ; Last block to lock
> >>>> CMPL CIB_L_FILSIZ(R7),R5 ; LE filesize?
> >>>> BGEQU 030$ ; Yes, continue
> >>>> MOVL CIB_L_FILSIZ(R7),R5 ; Else lock only to EOF
> >>>
> >>>
> >>> BLEQU, not BLSSU? Or BLSSU with 128?
> >>>
> >>> I'd suggest using a string constant for 127 (or 128) rather than a magic
> >>> number, too.
> >>>
> >>>
> >> Now I'm sorry I started this ...
> >>
> >> Ok, could you expound upon your comments? I'm totally not understanding.
> >>
> >> This particular code is from 1984, and written by Ben Carter, a much
> >> better Macro-32 programmer than I have ever been.
> >> --
> >> David Froble Tel: 724-529-0450
> >> Dave Froble Enterprises, Inc. E-Mail: da... at tsoft-inc.com
> >> DFE Ultralights, Inc.
> >> 170 Grimplin Road
> >> Vanderbilt, PA 15486
> >
> > I think the issue is more of style than anything else. This is kind of like opposite logic in higher level languages.
> > How often have you seen if statements like: If z .ge.20 then... Where: If Z .lt. 20 then could be used with different code. Both statements differentiate the value at the same point. Perhaps using less than makes more sense given the code stream where greater or equal does not? Context is important here.
> >
> > In your code segment, maybe the 127 makes more sense as a pivot point where 128 does not.
> The database code allows transfers up to 127 blocks. Sure looks right
> to me.
> > In regards to the use of a constant: I get it as using a constant allows for a name that may mean something rather than just hte value.
> >
> Ok, I understand. Not necessarily agree.
> --
> David Froble Tel: 724-529-0450
> Dave Froble Enterprises, Inc. E-Mail: da... at tsoft-inc.com
> DFE Ultralights, Inc.
> 170 Grimplin Road
> Vanderbilt, PA 15486
I have seen code like this many times in both forms. Some with the value and sometimes with the value equated to a name such as DB_block_transfer_limit.
While it seems unnecessary, the name becomes self-documenting. Also, should that limit change, you only need to change the definition line and not potentially many lines throughout the code.
I had to "upgrade" a FORTRAN based system because of this type of thing once. Very tedious. It would have been simpler if an include file was used for definitions. The same can be said for code segments too. I just completed a project where multiple programs contained the same subroutines repeated. Changing one routine resulted in changing 25 source files containing the same routine. Since I couldn't change the build environment, I was unable to remove the routine and place it into a library which would have been simpler.
More information about the Info-vax
mailing list