CINT problem?

From: Mike Heffner (mheffner@mppmu.mpg.de)
Date: Sat Nov 14 1998 - 19:13:49 MET


Hello,

	I am quite new to root and C++.  I am having trouble understanding
what CINT is doing.  CINT will execute code in blocks that it should not
enter.  The following is an example; 

---------------------------------------
int main(){

for(int i=0;i<5;i++){
  printf("Loop number %d\n",i);

  if(4>5) { //always false

    double xd[20]={0};   // this casues problems

    for(int u=0;u<1;u++){printf("Inside test loop\n");}
    printf("This should not be printed\n");

  } //if block

} //for loop
return 0;
}
------------------------------------------
	The if statement is always false.  So, I understand that code in
that block should never be executed?  If I compile this with a regular C++
compiler (g++) it works as I expect.  If I run this same code with CINT, I
get something I don't understand.  The first time through the first for
loop, I get the printed statement from the line "printf("This should not
be printed\n");". 
	I have found that if I remove either of the two lines,

   double xd[20]={0};   // this casues problems
        
    for(int u=0;u<1;u++){printf("Inside test loop\n");}

the problem goes away.  Could someone explain to me what is happening
here?

Thanks,
Mike Heffner



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