Overflow in implicit constant conversion_(re)
Sun, 14 Sep 1997 19:52:24 +0200 (MEST)
According to Robert Ketzscher:
>
> first of all I hope this is the right address to pose my
> problem.
It is. Welcome to the GNU Pascal mailing list!
> I get the message
> Overflow in implicit constant conversion
> at the end of the interface part (i.e. where implementation starts).
> I only use a handful constants and even after I commented them out
> I got the same message. I wrote a small unit typedefs as follows:
>
> unit typedefs;
>
> interface
>
> type longint = __long__ Integer;
> byte = __byte__ Integer;
> extended = __long__ Real;
> word = __short__ Integer;
> longstring = String[255];
> shortint = __byte__ Integer;
>
> implementation
>
> begin
> end.
Is this the unit which causes problems? It compiles well with
all versions of GPC I have at hand. Which version do you use?
If not, I only can guess that your problems come from initialized
`Byte' variables (typed constants) initialized with values above
127 because you define `Byte' as a signed type. To get an
unsigned `Byte', use
Type
ByteInt = __byte__ Integer;
Byte = __unsigned__ ByteInt;
If you have more problems and you are using gpc-2.0 or earlier,
you should upgrade to a more recent beta version of GPC, available
at ftp://agnes.dida.physik.uni-essen.de/gnu-pasal/beta/. The
latest official beta release is gpc-970714; the next one is in
preparation. This new GPC has the following types - and more -
built in:
Type
LongInt = __long__ Integer; (* 64 bits *)
ShortInt = __short__ Integer; (* 16 bits; `Integer' has 32 *)
ByteInt = __byte__ Integer; (* 8 bits *)
LongWord = __unsigned__ LongInt; (* 64 bits, unsigned *)
Word = __unsigned__ Integer; (* 32 bits, unsigned *)
ShortWord = __unsigned__ ShortInt; (* 16 bits, unsigned *)
Byte = __unsigned__ ByteInt; (* 8 bits, unsigned *)
Extended = __long__ Real; (* 80 bits *)
Hope this helps,
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201]
maintainer GNU Pascal [970714] - http://home.pages.de/~gnu-pascal/ [970125]
Peter Gerwinski (peter@agnes.dida.physik.uni-essen.de)
HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada -
Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es