Re: Re: [ROOT] Multiple function definitions

From: Jahred Adelman (Jahred_Adelman@brown.edu)
Date: Wed Jul 25 2001 - 15:35:13 MEST


Here is the example of the multiple function definitions that don't seem to work corrently. I was running ROOT v. 3.01/06. I found an old version (2.23/12), which doesn't seem to have the problem on my computer. The three functions can simply be:

void func(Text_t* PATTERN){
   printf ("One argument=%s", PATTERN);
}

void func(Text_t* PATTERN, int mini, int maxi){
   printf ("Three arguments = %s,%i,%i",PATTERN,mini,maxi);
}

void func(){
   printf("No arguments");
}

Calling func("String",2,3) or func("String") with the new version yields:
"No arguments"

-Jahred

> ----- Original Message ----- 
> From: "Jahred Adelman" <Jahred_Adelman@brown.edu>
> To: <roottalk@pcroot.cern.ch>
> Sent: Tuesday, July 24, 2001 4:34 PM
> Subject: [ROOT] Multiple function definitions
> 
> 
> > Hello - I admit to being a not-so-proficient programmer attempting to use ROOT.
> > I have 3 definitions for a function, say:
> > void test()
> > void test(Text_t* text)
> > void test(Text_t* text, int a, int b)
> > 
> > Shouldn't ROOT/C++ be smart enough to use the third instance when I call
> > test("text",1,2)? It doesn't seem to be. Is there a way to force this?
> > 
> > Thanks,
> > Jahred
> > 
> > 
> 
> 



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