最近碰到一些问题,查了帮助才知道
A Boolean variable occupies one byte of memory, a ByteBool variable also occupies one byte, a WordBool variable occupies two bytes (one word), and a LongBool variable occupies four bytes (two words).所以 Boolean(256)、Boolean(1024)等等都是False真是杯具,写了好多代码都用if Boolean(I) then来判断大于0为True的估计很多错误都不知道怎么办咯,。。

解决方案 »

  1.   

    我想知道楼主为什么这么做?Boolean(256)、Boolean(1024)
      

  2.   

    开始学delphi的时候有些用法跟C的写法搞混了,后面成习惯了,我以为都差不多
      

  3.   

    很奇怪吗?  TData = record
        case Byte of
        0:(Int : Integer);
        1:(bs:array [1..4]of Byte);
        2:(bbb:Boolean);
      end;
    var
      Form1: TForm1;
      Data : TData;
    implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
    begin
      Data.int := 255;//bbb=true//bs[1]=255
      Data.int := 256;//bbb=False//bs[1]=0
      Tag := Data.Int;
    end;
      

  4.   

    写了好多代码都用if Boolean(I) then来判断大于0为True的------------>if BOOL(I) then 可以判断是否等于0,但是这个不区分符号的,只要不等于0都是True
      

  5.   


    其实是判断不等于0, if BOOL(I) then不能判断是否不等于0,也不能判断是否等于0,你可以试试,
    Boolean(256)=Boolean(0)
      

  6.   

    不知道能否在system单元里重新定义Boolean
      

  7.   

    别去折腾System建议把Boolean改成函数(名称也改一下),批量替换一下。