[fpc-devel]Delphi incompatibility again!

Pavel V. Ozerski pavel at insect.mail.iephb.ru
Mon Apr 2 16:17:04 CEST 2001


>The value of true in a boolean is undefined. All checks for booleans are done using checks
>for zero or not zero.
>
It is true but if we don't use tricks. Example:

const
 x:array[0..1]of longint=(1,2);
var
 y:longbool;
 s:string;
begin
 readln(s);
 y:=s<>'';
 writeln(x[longint(y)])
end.

This sample is very abstract, of course. It will work correctly only compiled with FPC. But if x will be defined as
array[-1..0]of longint, only Delphi-compiled version will work properly.

Pavel
--
Pavel V. Ozerski            | Inst. of Evolutionary Physiology & Biochemistry,
office +7 (812)552-6870(291)|           Russian Academy of Sciences,
FAX    +7 (812)552-3012     |  Thorez pr. 44, St.Petersburg, 194223, Russia
home   +7 (812)528-5576     |  E-mail:  pavel at insect.mail.iephb.ru
                            |           pavel at insect.ief.spb.su





More information about the fpc-devel mailing list