Re: [ROOT] Strange problem with gPad

From: Valeri Fine (fine@bnl.gov)
Date: Fri Oct 19 2001 - 20:20:48 MEST


It sounds like CINT optimization problem.
ROOT CINT first checks (pre-compiles) the macro source to create the so-called 
bytecode then it  executes that.

You can try to disable the bytecode creation to see how it works. 
Just use ".O0" ROOT command and then launch your macro.


----- Original Message ----- 
From: "Chih-hsiang Cheng" <chcheng@SLAC.stanford.edu>
To: <roottalk@pcroot.cern.ch>
Sent: Thursday, October 18, 2001 7:24 PM
Subject: [ROOT] Strange problem with gPad


> Hi,
> 
>   I run a macro like this:
> 
> void gpad(Int_t p=0) {
>   for(Int_t index= 0; index < 1; index++) {
>     if (p==1) {
>       TCanvas *subcanvas= new TCanvas("canv","canv",800,950);
>       gPad->SetTopMargin(0.04);
>     }
>   }
> }
> 
> and it dies like this
> 
> root [1] .x gpad.cc(0)
> Error: non class,struct,union object $gPad used with . or -> FILE:gpad.cc LINE:5
> *** Interpreter error recovered ***
> 
> It looks very strange to me since that line (gPad->...) is never executed.
> It runs fine with .x gpad.cc(1) !
> 
> If I modify the macro to be
> 
> void gpad(Int_t p=0) {
>   if (p==1) {
>     TCanvas *subcanvas= new TCanvas("canv","canv",800,950);
>     gPad->SetTopMargin(0.04);
>   }
> }
> 
> it runs fine either with gpad.cc(1) or gpad.cc(0).
> 
> Anybody has an idea what's going on?
> I use 3.00/06 .
> 
> Chih-hsiang
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:03 MET