RE:Re: Strange #inlcude behaviour

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Tue Mar 16 1999 - 11:58:00 MET


Nick,

I could read the uuencoded version and cause of the problem is clear.

There are 2 kinds of ROOT macro.

//Type 1 : C++ source style --------------------
#include <math.h>
void macro() {
  // something
}

//Type 2 : ROOT special macro format -----------
{ // The first valid language constract must be '{'
  // someting
}

Note that Type1 macro is in the form of C++ syntax. You can write regular
C++ syntax like #include.  On the other hand, Type2 macro is ROOT special
format. This is not C++ syntax in precise sense. You can not put #include
before '{'.  CINT distinguishes type1 and 2 by the first valid letter in
the file. If it is '{' CINT takes it as type2 macro, otherwise CINT reads
the file as regular C++ source.

What happens in your case is that , because there is '#include' statement
at the beginning , the file is considered as regular C++ source. And in
regular C++,  enclosing statements in '{' '}' does not make sense.

Masaharu Goto

>Dear friends,
>I am running ROOT 2.20/06 on windows98 and experience a very
>strange behaviour.
>Attached you find the file bench.cc which runs correctly
>as can be seen from the logfile bench.log (also attached).
>However, if you UNCOMMENT the #include <math.h> statement
>and run bench.cc again, you will see that it finishes much
>more quickly and also the benchmark printout is missing.
>Could you please tell me what is going on here ?  
>-- 



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