This problem had already been fixed in 2.23/10. Rene Brun Anton Fokin wrote: > > Hi rooters, > > I think there is something wrong with TObjArray::AddAtFree(). Check the > following macro: > > 1: How it should work with AddLast(): > > { > TObjArray *Array = new TObjArray(); > > for (Int_t i=0;i<100;i++) { > TObject *Object = new TObject(); > Array->AddLast(Object); > printf("%d ",Array->GetLast()); > } > } > > Output: > > 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 > 29 > 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 > 55 56 > 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 > 82 8 > 3 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 > > That's just fine. > > 2: Now how it works with AddAtFree(): > > { > TObjArray *Array = new TObjArray(); > > for (Int_t i=0;i<100;i++) { > TObject *Object = new TObject(); > Int_t SlotNumber = Array->AddAtFree(Object); > Int_t LastNumber = Array->GetLast(); > printf("%d (%d) ",LastNumber,SlotNumber); > } > } > > -1 (0) -1 (1) -1 (2) -1 (3) -1 (4) -1 (5) -1 (6) -1 (7) -1 (8) -1 (9) -1 > (10) -1 > (11) -1 (12) -1 (13) -1 (14) -1 (15) 0 (0) 1 (1) 2 (2) 3 (3) 4 (4) 5 (5) 6 > (6) > 7 (7) 8 (8) 9 (9) 10 (10) 11 (11) 12 (12) 13 (13) 14 (14) 15 (15) 16 (16) 16 > (17 > ) 16 (18) 16 (19) 16 (20) 16 (21) 16 (22) 16 (23) 16 (24) 16 (25) 16 (26) 16 > (27 > ) 16 (28) 16 (29) 16 (30) 16 (31) 17 (17) 18 (18) 19 (19) 20 (20) 21 (21) 22 > (22 > ) 23 (23) 24 (24) 25 (25) 26 (26) 27 (27) 28 (28) 29 (29) 30 (30) 31 (31) 32 > (32 > ) 32 (33) 32 (34) 32 (35) 32 (36) 32 (37) 32 (38) 32 (39) 32 (40) 32 (41) 32 > (42 > ) 32 (43) 32 (44) 32 (45) 32 (46) 32 (47) 32 (48) 32 (49) 32 (50) 32 (51) 32 > (52 > ) 32 (53) 32 (54) 32 (55) 32 (56) 32 (57) 32 (58) 32 (59) 32 (60) 32 (61) 32 > (62 > ) 32 (63) 33 (33) 34 (34) 35 (35) 36 (36) 37 (37) > > I think that's wrong... or? > > Best regards, > Anton
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:17 MET