[Info-vax] Coding style in the VMS's
Arne Vajhøj
arne at vajhoej.dk
Wed Sep 29 09:23:02 EDT 2021
On 9/29/2021 9:02 AM, Simon Clubley wrote:
> On 2021-09-29, Arne Vajhøj <arne at vajhoej.dk> wrote:
>>
>> I posted this here a few months ago when this particular topic came up.
>>
>> "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;
>
> Is that a computed goto implemented in Pascal ????????????? :-)
>
> Wow.
>
> I wonder if it's possible to also make assigned goto (which was even
> more brain damaged IMHO) work in Pascal ?
>
> IOW, do any Pascal variants allow you to goto a label held within
> a variable ? (I hope not, but you never know.)
>
> I have absolutely no idea BTW if you can do this - I've never tried
> to do anything like that in Pascal.
No - it is emulating assigned goto as I don't think you can save a label
in a variable.
>> L922: I:=I+1;
>> WRITELN(I);
>> CASE(I)OF 1: GOTO L588; 2: GOTO L399; 3: GOTO L922; END;
This is the computed goto.
>> L399: GOTO L761;
>> L601: END.
Arne
More information about the Info-vax
mailing list