Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-10

TR: Strange Behaviour of TBits

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Julien Devillers

Hello

I found a strange behaviour of TBits. Example :

procedure TForm1.Button1Click(Sender: TObject);
var
  x:TBits;
begin
  x:=TBits.Create();
  x[0] := true;
  showmessage(inttostr( x.size));
  x[1] := false;
  showmessage(inttostr( x.size));
  x[2] := false;
  showmessage(inttostr( x.size));
  x[3] := true;
  showmessage(inttostr( x.size));
  x[4] := true;
  showmessage(inttostr( x.size));
end;

The above code returns 1, 2, 3, 3, 4 while it should return 1, 2, 3, 4, 5.

I Built a TMyBits class using strictly the TBits.inc file from fpc and... the bug does

not appear... !

I'm using lazarus 0.9.28.2 beta and fpc 2.2.4 with linux 64.

Did I miss something ?

regards

Julien

__________ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5531 (20101014) __________

Le message a été vérifié par ESET NOD32 Antivirus.

http://www.eset.com

Jonas Maebe
to Julien Devillers
Julien Devillers wrote 11 lines
The above code returns 1, 2, 3, 3, 4 while it should return 1, 2, 3, 4, 5. I Built a TMyBits class using strictly the TBits.inc file from fpc and... the bug does not appear... ! I'm using lazarus 0.9.28.2 beta and fpc 2.2.4 with linux 64. Did I miss something ?

Your example works fine with FPC 2.4.0, try upgrading.

Jonas

Julien Devillers
to Jonas Maebe

-----Message d'origine-----
De : De la part de Jonas Maebe
Envoyé : vendredi 15 octobre 2010 11:11
À : FPC-Pascal users discussions
Objet : Re: [fpc-pascal] TR: Strange Behaviour of TBits

Julien Devillers wrote 11 lines
The above code returns 1, 2, 3, 3, 4 while it should return 1, 2, 3, 4, 5. I Built a TMyBits class using strictly the TBits.inc file from fpc and... the bug does not appear... ! I'm using lazarus 0.9.28.2 beta and fpc 2.2.4 with linux 64. Did I miss something ?

Your example works fine with FPC 2.4.0, try upgrading.

Jonas