Hi,
I have the simple base class
[code]class TBase : public TObject
{
public:
TBase(TString T = “”);
};
TBase::TBase(TString FName)
{
printf(“Base: Called with ‘%s’\n”,FName.Data());
}
TBase::Print(Double_t D)
{
printf(“Called with %8.2f\n”,D);
}[/code]
(please notice that the Print() member function is not declared!).
The test script
{
gROOT->ProcessLine(".x TBase.C");
TBase A("Some");
A.Print(3.14);
}
results in
[quote]root [11] .x derivedtest.c
Base: Called with ‘’
(class TBase)125198896
Base: Called with ‘Some’
Called with 3.14[/quote]
After this, a quite unexpected error message appears,
[quote]root [13] .x derivedtest.c
Error: unrecognized language construct FILE:C:\veghj\projects\root\ewa\TBase.C LINE:5
*** Interpreter error recovered ***
Error: Function TBaseA(“Some”) is not defined in current scope FILE:C:\veghj\projects\root\ewa\derivedtest.c LINE:4
Possible candidates are…
filename line:size busy function type and name
*** Interpreter error recovered ***[/quote]
i.e. the line
TBase A("Some");
in interpreted in this strange way; a CINT error I experienced several times. In this case it is because I added the line to the class definition
(without semicolon). I think this misleading error message should be eliminated, too.
In addition, this message proves that the function declaration is scanned; but it looks like it is neglected. (If I change the definition to
void Print(TString D);
nothing changes, so it looks like member function declarations neglected: a source of serious errors, see overloading and default parameter values.
Then I added the missing semicolon, so the class declaration is now
class TBase : public TObject
{
public:
TBase(TString T = "");
void Print(Double_t D);
};
The result, however, is unchanged.
Is this again a kind of extension by CINT?
Janos