RE:ROOT Bug Report

Masaharu Goto (MXJ02154@nifty.ne.jp)
Wed, 02 Dec 1998 19:55:28 +0900


Christian,

>1. TString's (char*) typecast doesn't seem to work
>with printf()...
>
>01 root> TString s( "asdf" );
>02 root> cout << s << endl;
>03 asdf
>04 root> cout << (char*) s << endl;
>05 asdf
>06 root> printf("%s\n", (char*) s );
>07 ^PF <
>08 root> cout << s << endl:
>09 root> cout << s << endl;
>10 asdf
>11 root>
>
>i think i had a similar problem with the (char*)
>typecast when i was trying to pass a TString as an
>argument where a char* was expected.
>(workaround: use Data() member function instead of typecast)

TString has 'operator const char*()' but not 'operator char*()'. Cint
missed this one. I fixed this.

>2. also, regarding line 08 (where i have mistakenly typed
>":" instead of ";"), why is no output generated?

In this case 'cout<<s<<endl:' is taken as a label name. I wasn't checking
validity of label name. I can check for operator chars in label to verify.
But this can't be perfect.
root> s: ### NO ERROR, taken as label
There is no way to detect this error.

Masaharu Goto