catching illegal syntax

From: Dave Morrison (dave@bnl.gov)
Date: Wed Nov 25 1998 - 22:08:39 MET


Hi,

In using v2.00/13 I just came across this oddity: the following macro (yes, the
first line is missing a semicolon)

{
Float_t x = 1.0 
Float_t y = 2.0;
Float_t z = 3.0;
printf("x = %f\n", x);
printf("z = %f\n", z);
}

produces this output

root [0] .x test.C
x = 0.000000
z = 3.000000

I guess I'd have expected CINT to mark the first line as a syntax error instead
of silently setting x = 0.  I tried upping the security level, but there was no
change in the result

root [1] #pragma security level3
root [2] .x test.C              
x = 0.000000
z = 3.000000

I poked through the roottalk archives, but I didn't see this discussed (though I
certainly may have missed it).  Is this a known behavior of CINT?  If so,
doesn't it seem like a somewhat dangerous way to handle a very common error? 
Does this come about because CINT doesn't require a semicolon at the command
line?  

Actually, if I type the lines of my macro one-by-one at the command line
everything works fine:

root [0] Float_t x = 1.0  
root [1] Float_t y = 2.0;
root [2] Float_t z = 3.0;
root [3] printf("x = %f\n",x);
x = 1.000000
root [4] printf("z = %f\n",z);
z = 3.000000

Any guidance on how to convince CINT to complain about my syntax error would be
greatly appreciated.

Thanks,
Dave

-- 
David Morrison  Brookhaven National Laboratory  phone: 516-344-5840
                Physics Department, Bldg 510 C    fax: 516-344-3253
		          Upton, NY 11973-5000  email: dave@bnl.gov



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