Re: [ROOT] Different behaviour (i.e. Crash) of TString on Linux and Windows

From: Nick van Eijndhoven (Nick@phys.uu.nl)
Date: Fri Mar 05 2004 - 13:08:40 MET


Hi Andreas,
I have seen this behaviour in the past as well, but understood
that the problem should be fixed now in ROOT version 4.
Anyhow, the way I solved the problem was by

cout << W.Data() << endl;

This works correctly on all platforms and gives the correct output.

Cheers,
Nick.


-- 
Dr. Nick van Eijndhoven mailto:nick@phys.uu.nl http://www.phys.uu.nl/~nick
__________________________________________________________________________

Org.:    Utrecht University, Faculty of Physics and Astronomy
Address: Princetonplein 5, NL-3584 CC Utrecht, The Netherlands
Phone:   +31-30-2532331(direct) +31-30-2531492(secr.)  Fax: +31-30-2518689
CERN:    +41-22-7679751(direct) +41-22-7675857(secr.)  Fax: +41-22-7679480
Offices: Buys Ballot laboratory Room 710 (Utrecht)   B23 1-020 (CERN)
__________________________________________________________________________


Andreas Zoglauer wrote:

> Hello Valeri,
> 
> In CINT I get the same behavior.
> 
> Nevertheless compiling the code with Visual C++ 6 SP 3 gives no crash 
> with cout<<(const char *)W<<endl; but still crashes with cout<<W<<endl;!!
> 
> Nevertheless, also CINT should give an output for cout<<W<<endl, 
> shouldn't it?
> 
> It would be very helpful for my to find a solution for the problem, 
> since I am trying to port a large program to Windows and unfortunatly I 
> use this calls very, very often.
> 
> Thanks,
> Andreas
> 
> 
> 
> Valeri Fine wrote:
> 
>> It seems to me I have found the related topics:
>>
>> http://root.cern.ch/phpBB2/viewtopic.php?t=442&highlight=
>> and
>> http://root.cern.ch/root/roottalk/roottalk04/0097.html
>>
>>
>>
>> Anyway I was not able to reproduce the crash.
>> The only problem I found calling from CINT interactive session:
>>
>>     TString W = "Hello World";
>>     cout<<W<<endl;               // there is no output
>>     cout<<(const char *)W<<endl; // it is Ok
>>     Hello World
> 
>  > ----
>  > Best regards
>  >                   Valeri
> 
> 



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET