'CASE' bug!_(re)

Mon, 6 Oct 1997 00:27:19 +0200



Bernhard Tschirren wrote:

> Hmm, it seems that GPC (971001-DJGPP) is plagued by TurboPascal's famous
> 'CASE' bug. Have a go at compiling the sample program below:
>
>
> Var
>     I : Integer;
> Begin
>     Case I Of
>         1:   WriteLn('One');
>         2:   WriteLn('Two');
>         Else WriteLn('Big');
>
>         WriteLn('BUG!');
>     End;
> End.
>
>
> Now how did that bug get there :) Cya L8r

What bug, please? According to BP, the "else" of a case doesn't require
"begin" and "end" for multiple statements, and that's how GPC behaves.

I think it is OK, since the "else" part is always terminated by the
"case"'s "end", so it's clear how far the else extends, even without
another "begin" and "end". SP and EP (AFAIK) don't use "else" but
"otherwise" in a "case" statement, so they don't apply here.
(If GPC behaves wrong with "otherwise", that's another thing, I don't know.)

Or do you mean anything different? (I was guessing the above from your
indentation since you didn't state the problem.)

--
Frank Heckenbach, Erlangen, Germany
heckenb@mi.uni-erlangen.de
http://home.pages.de/~fjf/links.htm


Frank Heckenbach (heckenb@mi.uni-erlangen.de)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es