This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: continuing woes with ostream


benjamin kosnik writes:
>
>I know it's a bunch of work, but really, I think your best bet is making
>a test case that I can add to the testsuite. . .that way the problem
>will get fixed and remain fixed. . .

OK, I have come up with a small test program which exhibits the problem.
The bug-tracking site appears broken (cookie trouble).

It took quite some time to figure this out.  But if you try to append
to a string using the concatenation operator, then after 8192 bytes
the insertion will come from the beginning of the string.

If you run this test program, then you will see the problem on like 820
of out.log:

1223456789

it's reading stuff in from the beginning of the string.  Definite bug!!!
Dave


#include <string>
#include <fstream>
#include <iostream>

int main()
{
  int size=1000;
  string filename;
  string x;

  filename = "out.log";
  std::ofstream f("out.log");

  for(int i=0 ; i < size; i++) {
    x += '1';
    x += '2';
    x += '3';
    x += '4';
    x += '5';
    x += '6';
    x += '7';
    x += '8';
    x += '9';
    x += '\n';
  }

  f << x;
  f.close();

  return 0;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]