[ROOT] pointers to pointers

From: E.Moyse (E.Moyse@qmw.ac.uk)
Date: Mon Jun 19 2000 - 15:45:09 MEST


Hi everyone.

I had a macro that was running okay in CINT most of th etime and then
occasioanlly would fall over with a seg. fault. As you can probably
imagine it took a while to track down: I was defining arrays of pointers
to TH1F and TGraph objects, but mistakenly writing

TH1F *passed_histo = new TH1F[thresholds];

instead of 

TH1F **passed_histo = new TH1F*[thresholds];

Unfortunately CINT seemed perfectly happy with this ... right up to the
apparently random point where it crashed. I found the bug(?) by compiling
the macro... 

Is there any reason for CINT not picking up on mistakes like this? I'm
very surprised the program ran at all - I would have thought it'd stop as
soon as I tried creating the objects. This would have been very helpful!

Thanks,

Ed Moyse



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:28 MET