[fpc-pascal]Problem with CASE statement

Lubomir.Cabla at cssz.cz Lubomir.Cabla at cssz.cz
Tue Mar 23 14:20:34 CET 2004

In go32v2 i got a problem with case statement.
With compiler 1.0.10 is this without errors:

const kbDown = $5000;
      kbUp   = $4800;
var ch : char;
  case ord(ch) of
    Hi(kbDown): writeln('kbDown');
    Hi(kbUp)  : writeln('kbUp');

New FPC compiler 1.9.3 produced error 'duplicate case label'.

With these commands i found that function HI produced 0 for both constants.


OK i changed definition of kbDown and kbUp to

const kbDown : word = $5000;
      kbUp   : word = $4800;

and now Hi(kbDown) return $50 etc. but with compilation
i got another error 'Constant Expression expected'.

I know what this is but i don't understand why.

Maybe somebody help me ?

This definition 'const kbDown = $5000;' produced word or logint or ... ?

Lubomir Cabla

More information about the fpc-pascal mailing list