RE: CINT stringstream bug

From: Philip Rodrigues <p.rodrigues1_at_physics.ox.ac.uk>
Date: Tue, 1 Apr 2008 15:43:09 +0100


Hi Axel,
Thanks for the suggestion - I'll try it out. Would it be possible to have CINT generate a warning or an error when attempting to cast an istream to a bool? This would help protect against bugs in users' code.

By the way, more generally, is there a list anywhere of STL features that are not yet implemented in CINT? I've noticed a few other things, which I think are known issues, but I'd like to be able to check.

Regards,
Philip

>-----Original Message-----
>From: Axel Naumann [mailto:Axel.Naumann_at_cern.ch]
>Sent: 01 April 2008 15:04
>To: Philip Rodrigues
>Cc: roottalk_at_root.cern.ch
>Subject: Re: [ROOT] CINT stringstream bug
>
>Hi Philip,
>
>the problem is the cast from istream to bool which just
>doesn't work right with
>CINT. Use the explicit test with good() instead:
>
>#include <sstream>
>#include <string>
>#include <iostream>
>
>void cint_stringstream()
>{
> stringstream s("a b c");
> string tmp;
> while (s.good()) {
> s >> tmp;
> cout << tmp << endl;
> }
>}
>
>Cheers, Axel.
>
>On 2008-03-31 18:33, Philip Rodrigues wrote:
>> The following code snippet (attached as a macro), produces different
>> results in interpreted mode and when compiled (with recent
>development
>> root):
>>
>> stringstream s("a b c");
>> string tmp;
>> while (s >> tmp) cout << tmp << endl;
>>
>> For some reason, the "s >> tmp" evaluates to false one
>"step" too early
>> in interpreted mode. Example session is below.
>>
>> dev pplxgenng:~> root -q cint_stringstream.C
>> Processing cint_stringstream.C...
>> a
>> b
>>
>> dev pplxgenng:~> root -q cint_stringstream.C+
>> Processing cint_stringstream.C+...
>> a
>> b
>> c
>>
>> Regards,
>> Philip
>
Received on Tue Apr 01 2008 - 16:43:19 CEST

This archive was generated by hypermail 2.2.0 : Tue Apr 01 2008 - 17:50:01 CEST