Hi ROOT'ers,
It seems that ROOT's I/O insist on the array size of pointer data
member to be an Int_t or UInt_t - why not a Short_t or UShor_t, or
even Long_t or ULong_t? For example
class Foo : public TObject
{
private:
UShort_t fN; // Array size <= doesn't work - why?
// Short_t fN; // Array size <= doesn't work - why?
// Int_t fN; // ROOT's I/O insists on an 'interger' - why?
// UInt_t fN; // ROOT's I/O insists on an 'interger' - why?
Short_t* fArray; //[fN] Data Array
public:
Foo() : fN(0) { fArray = 0; }
Foo(UShort_t n) : fN(n) {
fArray = new Short_t[fN];
for (UShort_t i = 0; i < n ; i++)
fArray[i] = i;
}
void Print(Option_t* option="") const {
for (UShort_t i = 0; i < fN ; i++)
cout << " " << setw(3) << fArray[i] << flush;
cout << endl;
}
ClassDef(Foo, 1) // A Foo class
};
It seems like a waste of 2 perfectly good bytes to insist on having a
(4 byte) Int_t/UInt_t when most often a (2 byte) Short_t/UShort_t
could do.
This ROOT using 3.01/05.
Yours,
Christian -----------------------------------------------------------
Holm Christensen Phone: (+45) 35 35 96 91
Sankt Hansgade 23, 1. th. Office: (+45) 353 25 305
DK-2200 Copenhagen N Web: www.nbi.dk/~cholm
Denmark Email: cholm@nbi.dk
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:50 MET