From: Dave Hayden on
On Apr 15, 8:19 pm, Han <handuongs...(a)gmail.com> wrote:
> I am current working up updating Jazz for the HP50G. Every now and
> then, I run into the simple comment "BET" and have no idea what this
> means. Can anyone shed some light on this?

This is the sort of comment that drives me crazy as a programmer.
Comments are supposed to help the maintainer understand the code. A
comment like "BET" just confuses the poor person instead. It
distracts them from their work and sends them off to comp.sys.hp48.
In other words, the comment does the exact OPPOSITE of what it should
do.

Even if the comment said "branch every time" it would most likely be a
waste of space in anything but an example in an introductory
programming class. If the program branches every time, then the code
itself will say that because it uses a JUMP instruction or something
similar.

The code itself says *what* it is doing. The comments should say *how*
the code implements the algorithm and *why* the algorithm is necessary
to solve the overall problem.

[\rant]
Dave
From: Han on
On Apr 17, 7:01 am, Dave Hayden <d...(a)larou.com> wrote:
> On Apr 15, 8:19 pm, Han <handuongs...(a)gmail.com> wrote:
>
> > I am current working up updating Jazz for the HP50G. Every now and
> > then, I run into the simple comment "BET" and have no idea what this
> > means. Can anyone shed some light on this?
>
> This is the sort of comment that drives me crazy as a programmer.
> Comments are supposed to help the maintainer understand the code.  A
> comment like "BET" just confuses the poor person instead.  It
> distracts them from their work and sends them off to comp.sys.hp48.
> In other words, the comment does the exact OPPOSITE of what it should
> do.
>
> Even if the comment said "branch every time" it would most likely be a
> waste of space in anything but an example in an introductory
> programming class.  If the program branches every time, then the code
> itself will say that because it uses a JUMP instruction or something
> similar.
>
> The code itself says *what* it is doing. The comments should say *how*
> the code implements the algorithm and *why* the algorithm is necessary
> to solve the overall problem.
>
> [\rant]
> Dave

I think in the particular case of BET, at least where I see it used,
just says to the code reader that this loop must always be reached
under any and all circumstances (which can be significant when
debugging loops that either are never reached or are infinite). Or,
perhaps I do not understand what branch every time means, even decoded
from its acronym =)
From: Raymond Del Tondo on
"Dave Hayden" <dave(a)larou.com> schrieb im Newsbeitrag
news:90d0703d-ab57-4be2-a31d-eb88cd07dcdb(a)y17g2000yqd.googlegroups.com...
On Apr 15, 8:19 pm, Han <handuongs...(a)gmail.com> wrote:
>> I am current working up updating Jazz for the HP50G. Every now and
>> then, I run into the simple comment "BET" and have no idea what this
>> means. Can anyone shed some light on this?
>
>This is the sort of comment that drives me crazy as a programmer.
>Comments are supposed to help the maintainer understand the code.
>A comment like "BET" just confuses the poor person instead. It
>distracts them from their work and sends them off to comp.sys.hp48.
>In other words, the comment does the exact OPPOSITE of what it should
>do.
>
Maybe the first time the poor person sees the BET.
But then he/she learns the meaning of that new word, and all is fine;-)

I have seen the BET (or B.E.T.) comment in various programming projects,
and it always meant the same thing: Branch Every Time...


> Even if the comment said "branch every time" it would most likely be a
> waste of space in anything but an example in an introductory
> programming class. If the program branches every time, then the code
> itself will say that because it uses a JUMP instruction or something
> similar.
>
No. The BET comment usually stands in a code line of a
_conditional_ jump instruction, not in a line with an unconditional jump,
so it's not clear from the mnemonic itself whether the jump will be
conditional as the code says, or "always" as the BET comment says.

I agree that it may confuse beginners,
and actually there are many code examples for beginners,
with more educative comments, and a source text structure
which may ease diving into for beginners.

However there are code examples which may not be perfectly suitable for
beginners,
like the RPL48 or JAZZ sources, or a somewhat more complex JAVA or C++
source.

Raymond

From: Tom Lake on

> No. The BET comment usually stands in a code line of a
> _conditional_ jump instruction, not in a line with an unconditional jump,
> so it's not clear from the mnemonic itself whether the jump will be
> conditional as the code says, or "always" as the BET comment says.
>
> I agree that it may confuse beginners,
> and actually there are many code examples for beginners,
> with more educative comments, and a source text structure
> which may ease diving into for beginners.
>
> However there are code examples which may not be perfectly suitable for
> beginners,
> like the RPL48 or JAZZ sources, or a somewhat more complex JAVA or C++
> source.

Hmmm. I've been programming since 1970 and have never run into
BET in thousands of FORTRAN, COBOL, BAL and BASIC programs. Why
would you put in a conditional if the program is always supposed to
branch at that point?

Tom Lake


From: Han on
On Apr 17, 12:08 pm, "Raymond Del Tondo" <Ih8...(a)nowhere.com> wrote:
> "Dave Hayden" <d...(a)larou.com> schrieb im Newsbeitragnews:90d0703d-ab57-4be2-a31d-eb88cd07dcdb(a)y17g2000yqd.googlegroups.com...
> On Apr 15, 8:19 pm, Han <handuongs...(a)gmail.com> wrote:>> I am current working up updating Jazz for the HP50G. Every now and
> >> then, I run into the simple comment "BET" and have no idea what this
> >> means. Can anyone shed some light on this?
>
> >This is the sort of comment that drives me crazy as a programmer.
> >Comments are supposed to help the maintainer understand the code.
> >A comment like "BET" just confuses the poor person instead.  It
> >distracts them from their work and sends them off to comp.sys.hp48.
> >In other words, the comment does the exact OPPOSITE of what it should
> >do.
>
> Maybe the first time the poor person sees the BET.
> But then he/she learns the meaning of that new word, and all is fine;-)
>
> I have seen the BET (or B.E.T.) comment in various programming projects,
> and it always meant the same thing: Branch Every Time...
>
> > Even if the comment said "branch every time" it would most likely be a
> > waste of space in anything but an example in an introductory
> > programming class.  If the program branches every time, then the code
> > itself will say that because it uses a JUMP instruction or something
> > similar.
>
> No. The BET comment usually stands in a code line of a
> _conditional_ jump instruction, not in a line with an unconditional jump,
> so it's not clear from the mnemonic itself whether the jump will be
> conditional as the code says, or "always" as the BET comment says.
>
> I agree that it may confuse beginners,
> and actually there are many code examples for beginners,
> with more educative comments, and a source text structure
> which may ease diving into for beginners.
>
> However there are code examples which may not be perfectly suitable for
> beginners,
> like the RPL48 or JAZZ sources, or a somewhat more complex JAVA or C++
> source.
>
> Raymond

This is what I meant The jump statement itself is something like, say,
GOC <label> as opposed to GOTO <label>. When I think back to the times
I saw BET, it was often this case. The intended behavior is to always
reach the <label> (presumably of a loop) even though the call is GOC
<label>. This helps anyone else looking at the code later on
understand the implied state of the CPU (e.g. carry must be clear
here).