Sign in Join

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

Mailing lists / lazarus / 2010-10

Strange Behaviour of TBits

4 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.4.0 with linux 64.

Did I miss something ?

regards

Julien

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20101014/f2335c17/attachment.html>

Reply by email

Julien Devillers
to Julien Devillers

De : Julien Devillers [mailto:]
Envoy? : jeudi 14 octobre 2010 11:24
? : Lazarus mailing list
Objet : [Lazarus] Strange Behaviour of TBits

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.4.0 with linux 64.

Did I miss something ?

regards

Julien

-----------------------

Correction : I'm using FPC 2.2.4.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20101014/c8045c31/attachment.html>

Reply by email

Gerard N/A
to Julien Devillers

Hi,

FWIW, I get 1,2,3,4,5 with FPC 2.4.0 under Win XP 32 bits (Latest SVN Lazarus, but I think that not relevant).
TBits is from the FPC RTL. Maybe you should ask in the FPC list ( ).

Regards,

Gerard.

2010/10/14 Julien Devillers

Show quoted text 100 lines
*De :* Julien Devillers [mailto:] *Envoy? :* jeudi 14 octobre 2010 11:24 *? :* Lazarus mailing list *Objet :* [Lazarus] Strange Behaviour of TBits 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.4.0 with linux 64. Did I miss something ? regards Julien ----------------------- Correction : I?m using FPC 2.2.4. __________ Information provenant d'ESET NOD32 Antivirus, version de la base des signatures de virus 5530 (20101014) __________ Le message a ?t? v?rifi? par ESET NOD32 Antivirus. http://www.eset.com -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20101014/39055f9f/attachment.html>

Reply by email

Julien Devillers
to Gerard N/A

ok thanks

Julien

De : Gerard N/A [mailto:]
Envoy? : jeudi 14 octobre 2010 15:27
? : Lazarus mailing list
Objet : Re: [Lazarus] Strange Behaviour of TBits

Hi,

FWIW, I get 1,2,3,4,5 with FPC 2.4.0 under Win XP 32 bits (Latest SVN Lazarus, but I think that not relevant). TBits is from the FPC RTL. Maybe you should ask in the FPC list ().

Regards,

Gerard.

2010/10/14 Julien Devillers

De : Julien Devillers [mailto:]
Envoy? : jeudi 14 octobre 2010 11:24
? : Lazarus mailing list
Objet : [Lazarus] Strange Behaviour of TBits

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.4.0 with linux 64.

Did I miss something ?

regards

Julien

-----------------------

Correction : I'm using FPC 2.2.4.

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

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

http://www.eset.com

Reply by email