[Info-vax] BASIC (and Horizon)

Chris Townley news at cct-net.co.uk
Tue Jan 30 09:40:34 EST 2024


On 30/01/2024 07:06, Dave Froble wrote:
> On 1/29/2024 8:02 PM, Arne Vajhøj wrote:
>> On 1/29/2024 7:50 PM, kludge at panix.com wrote:
>>> =?UTF-8?Q?Arne_Vajh=C3=B8j?=  <arne at vajhoej.dk> wrote:
>>>> The code is VB6.
>>>>
>>>> But none of the problems are Basic specific. It is possible
>>>> to write the same bad code in C or Fortran or whatever.
>>>>
>>>> So it just shows that there are some really really bad programmers out
>>>> there.
>>>
>>> I have worked with people who could write spaghetti Fortran in any
>>> programming language available.
>>
>> "A real Fortran programmer can write Fortran in any language"
>>
>> Every time this comes up I post this Fortran/Pascal code:
>>
>>       PROGRAM GOTOFUN(INPUT,OUTPUT);
>>       LABEL L731,L113,L247,L588,L761,L922,L399,L601;
>>       VAR LBL:INTEGER;
>>       VAR I:INTEGER;
>>       BEGIN
>> L731: GOTO L113;
>>       LBL:=399;
>> L113: I:=0;
>>       WRITELN(I);
>> L247: LBL:=601;
>>       IF(I<0)THEN GOTO L588 ELSE IF(I=0)THEN GOTO L922 ELSE GOTO L399;
>> L588: I:=I+1;
>>       WRITELN(I);
>>       GOTO L399;
>> L761: CASE(LBL)OF 399: GOTO L399; 601: GOTO L601; END;
>> L922: I:=I+1;
>>       WRITELN(I);
>>       CASE(I)OF 1: GOTO L588; 2: GOTO L399; 3: GOTO L922; END;
>> L399: GOTO L761;
>> L601: END.
>>
>> :-)
>>
>> Arne
>>
> 
> I'm amused every time the GoTo bashing begins.
> 
> Not only is there nothing wrong when using a branch operation, when 
> appropriate, just look at the assembler listings after compilation.  
> Branching is just about all assembler does, as required.
> 
> Now, I won't defend what I and most consider improper use of the poor 
> misunderstood GoTo statement.
> 

But unless used very carefully, it can create horrible spaghetti like 
code, and is also easy to screw up.

Using proper structured constructs is much better - easier to read as 
well, hence better maintainability.


-- 
Chris




More information about the Info-vax mailing list