Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2005-05-10 14:23:26


On May 10, 2005, at 5:41 AM, Gennaro Prota wrote:

> --- Doug Gregor <dgregor_at_[hidden]> wrote:
>> The stream extraction operators for dynamic_bitset are failing on
>> CodeWarrior 9.4. See: http://tinyurl.com/addko
>> Is anyone familiar enough with the quirks of Metrowerks' iostreams to
>> fix this issue?
>
> Hi Doug, Jeremy and Howard
>
> unfortunately, due to a series of vicissitudes that would be too long
> to tell,
> I have no home connection at the moment (a situation that lasts from
> several
> months) and thus I can't work on CVS. Howard Hinnant is probably the
> person who
> knows Metrowerks compiler and library best. Howard?

This is preliminary, but I'm currently thinking this is compiler error.
  The following local array:

   std::string strings[] = {
                   // NOTE: "const" gives the usual problems with Borland
                   // (in Tests::stream_extractor instantiation)

#if !(defined __BORLANDC__ \
       && BOOST_WORKAROUND(BOOST_RWSTD_VER, BOOST_TESTED_AT(0x20101)))
                                         // Borland 5.5.1 with RW
library crashes
             // empty string
             std::string(""),
             // no bitset
             spaces,
#endif
             // no bitset
             std::string("x"),
             std::string("\t xyz"),

             // bitset of size 1
             std::string("0"),
             std::string("1"),

             std::string(" 0 "),
             std::string(" 1 "),
             spaces + "1",
             "1" + spaces,
             spaces + "1" + spaces,
             std::string(" x1x "),
             std::string(" 1x "),

             // long bitset
             long_string,
             " " + long_string + " xyz",
             spaces + long_string,
             spaces + long_string + spaces
     };

in run_test_cases() appears to get destructed right after it is
constructed. I haven't figured out what the trigger is yet. I haven't
been able to reproduce the symptom in a smaller example, and it doesn't
appear to happen with the other strings[] local array:

     std::string strings[] = {
                                   std::string(""),
                                   std::string("0"),
                                   std::string("1"),
                                   std::string("11100"),
                                   get_long_string()
                                 };

Destruction of "short" strings is harmless as we're using the short
string optimization. But once you hit strings[13] (corresponding to
the long_string entry) then the test starts working with a string with
entries other than '0' and '1', and things pretty much fall apart.

A workaround is to declare the strings[] array static.

I've sent a test case to the compiler team and if they turn up any
further information or workarounds I'll pass it on here.

-Howard


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk