[Info-vax] Listeners in VMS Basic, was: Re: Integrity iLO Configuration?
Dave Froble
davef at tsoft-inc.com
Wed Jul 14 18:51:09 EDT 2021
On 7/14/2021 4:19 PM, VAXman- at SendSpamHere.ORG wrote:
> In article <scan1i$ihg$1 at dont-email.me>, Dave Froble <davef at tsoft-inc.com> writes:
>> On 7/9/2021 2:28 PM, Arne Vajhøj wrote:
>>> On 7/1/2021 6:29 PM, Craig A. Berry wrote:
>>>> On 7/1/21 3:24 PM, Dave Froble wrote:
>>>>> To be such, there is no such thing as too many comments.
>>>>
>>>> Too many comments is just as bad a code smell as too few. Comments can
>>>> easily get out of date and people make mistakes by reading and believing
>>>> comments that no longer reflect what actually happens. Comments should
>>>> provide some brief indication of what and why without getting too far
>>>> into the how.
>>>
>>> Yes.
>>>
>>> And other agree:
>>>
>>> https://stackoverflow.blog/2021/07/05/best-practices-for-writing-code-comments/
>>>
>>>
>>> Arne
>>
>> 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
>
> Isn't 0 < 127?
>
The problem with small pieces of code is the capability of
misunderstandings. In the above piece, the concept is to start with a
"starting block", and add the size of the I/O buffer (in blocks) to get
a range for locking.
Base block zero, failure.
Block count more than 127, failure.
If going past EOF, then lock (and read) only to EOF.
Gee, isn't that what the comments say? How about that? Maybe comments
are helpful?
--
David Froble Tel: 724-529-0450
Dave Froble Enterprises, Inc. E-Mail: davef at tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA 15486
More information about the Info-vax
mailing list