Re:include issue

From: $B8eF#!!@5<#(
Date: Sat Sep 13 1997 - 14:42:00 MEST


Andrew,
INET:andrews@physicx.berkeley.edu

 Rene asks me to answer this.

 Your example is a legal C/C++ code, however, please do not use #include 
in this way. CINT handles #include files a little smarter than compilers. 
But it can't handle some minor case usage like this.
Please don't use #include with in a function for CINT.

> // START "testinclude"//
>Char_t  teststring[80];
>Int_t testint;
>sprintf(teststring,"This is my test string.");
>testint = 50;
>// END "testinclude" //
>And here is a program that tries to include it:
>#pragma includepath [my path goes here] 
>testfun()  { 
> #include <testinclude>
> printf("The integer will print: %d\n",testint);  
> printf("But the string will not: %s",teststring);  
>}

 I modified above files. Use macro with a dummy argument. CINT can
handle this type of macro. Include the header outside of the function
and use INITTEST(0); in the function.

======header====================================
#define INITTEST(dmy)       \
  Char_t  teststring[80];   \
  Int_t testint;            \
  sprintf(teststring,"This is my test string.");  \
  testint = 50

======source====================================
And here is a program that tries to include it:
#pragma includepath [my path goes here] 
#include <testinclude>
testfun()  { 
 INITTEST(0);
 printf("The integer will print: %d\n",testint);  
 printf("But the string will not: %s",teststring);  
}


Masaharu Goto



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