[fpc-pascal]Problem with CASE statement

Lubomir.Cabla at cssz.cz Lubomir.Cabla at cssz.cz
Wed Mar 24 07:58:48 CET 2004


Yes, you're right but i'm using this constants for backward compatibility
with Borland Pascal.

The problem is in declarations of constant:

const xxx = $4400;
         yyy = $11;

SizeOf(xxx) = 2 in FPC 1.0.10
                     4 in FPC 1.9.x
SizeOf(yyy) = 1 in FPC 1.0.10
                     4 in FPC 1.9.x

Constants xxx and yyy are ordinal types, but i don't know which count of
bytes they got.

Maybe now are all constants defined like longword (dword), but in PDF doc
for 1.9.2
i can not find this.

Lubomir Cabla

-----Original Message-----
From: Matt Emson [mailto:memsom at interalpha.co.uk]
Sent: Tuesday, March 23, 2004 3:19 PM
To: fpc-pascal at lists.freepascal.org
Subject: Re: [fpc-pascal]Problem with CASE statement

> 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;
> begin
>   ch:=ReadKey;
>   case ord(ch) of
>     Hi(kbDown): writeln('kbDown');
>     Hi(kbUp)  : writeln('kbUp');
>   end;
> end.

Delphi (5 at least) enforces case items to be constants, ie. fixed at
compile time..... this looks to be the thing that's changed in the
compiler's default mode. Maybe another mode supports extended case

Anyway, define a const for $50 and $48 and use them... aren't these values
fixed at compile time anyway ?

fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org

More information about the fpc-pascal mailing list