Re: Random numbers according to histos and functions.

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Tue May 20 1997 - 15:53:01 MEST


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.



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:19 MET