Re: Random numbers according to histos and functions.

Fons Rademakers (Fons.Rademakers@cern.ch)
Tue, 20 May 1997 15:53:01 +0200


Rene Brun wrote:
>
> I suppose you mean:
> Double_t *y = new Double_t[100]
>
> I know that this is a very frequent mistake when coming from Fortran.
> the instruction new Double_t(100) means in C++:
> Allocate a new object at address 100 !!
>

Small correction "new Double_t(100)" calls constructor of
Double_t with argument 100 (so *y gets initialized to 100.0).
Allocating at address 100 is done via placement new:
Double_t *y = new(100) Double_t;

God, I love C++.

Cheers, Fons.