You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@stdcxx.apache.org by Mark Wright <ma...@internode.on.net> on 2008/03/25 11:41:47 UTC

copy ostringstream ostream_iterator output out of order

Hello,

I compile and run following the program with stdcxx compiled from subversion
(svn update and compiled today) with Sun Studio 12 64 bit build mode 15D:

#include <string>
#include <iostream>
#include <sstream>
#include <iterator>
#include <algorithm>

char char_array[] =
"Ptolemy, in the 2nd century AD, measured longitude eastward from a reference "
"meridian 2 degrees west of the Canary Islands. In 1493, Pope Alexander VI "
"established a line in the Atlantic west of the Azores to divide the "
"territories of Spain and Portugal. For many years, cartographers of these two "
"countries used this dividing line as the prime meridian. In 1570 the Dutch "
"cartographer Ortelius used the easternmost of the Cape Verde Islands. John "
"Davis, in his 1594 The Seaman's Secrets, used the Isle of Fez in the Canaries "
"because there the variation was zero.";

int main(int argc, char *argv[])
{
  std::string str(char_array);
  std::ostringstream m;
  std::copy(
    str.begin(),
    str.end(),
    std::ostream_iterator<char>(m));
  m << '\n';
  std::string result = m.str();
  std::cout << result;
  return 0;
}

With the Makefile:

ostr : ostr.o
	CC -D_RWSTDDEBUG -mt -g -xdebugformat=stabs -xs -m64 -library=%none -I/h/goanna/1/a_5.10_m64/c/include -o ostr ostr.o -L/h/goanna/1/a_5.10_m64/c/lib  -R/h/goanna/1/a_5.10_m64/c/lib -lstd15D

ostr.o : ostr.cpp
	CC -D_RWSTDDEBUG -mt -g -xdebugformat=stabs -xs -m64 -library=%none -I/h/goanna/1/a_5.10_m64/c/include -c ostr.cpp

clean:
	rm ostr ostr.o

I am wondering if I am doing something wrong, as the output is
out of order:

goanna% gmake      
CC -D_RWSTDDEBUG -mt -g -xdebugformat=stabs -xs -m64 -library=%none -I/h/goanna/1/a_5.10_m64/c/include -c ostr.cpp
CC -D_RWSTDDEBUG -mt -g -xdebugformat=stabs -xs -m64 -library=%none -I/h/goanna/1/a_5.10_m64/c/include -o ostr ostr.o -L/h/goanna/1/a_5.10_m64/c/lib  -R/h/goanna/1/a_5.10_m64/c/lib -lstd15D
goanna% ./ostr     
the Canaries because there the variation was zero.
eastward from a reference meridian 2 degrees west of the Canary Islands. In 1493, Pope Alexander VI established a line in the Atlantic west of the Azores to divide the territories of Spain and Portugal. For many years, cartographers of these two countries used this dividing line as the prime meridian. In 1570 the Dutch cartographer Ortelius used the easternmost of the Cape Verde Islands. John Davigoanna% 

Thanks, Mark

-- 

Re: copy ostringstream ostream_iterator output out of order

Posted by Mark Wright <ma...@internode.on.net>.
Hello Farid,

The fix works great, thanks very much.

Thanks, Mark

On Tue, 25 Mar 2008 16:47:16 +0200
"Farid Zaripov" <Fa...@epam.com> wrote:

> > -----Original Message-----
> > From: Mark Wright [mailto:markwright@internode.on.net] 
> > Sent: Tuesday, March 25, 2008 12:42 PM
> > To: user@stdcxx.apache.org
> > Subject: copy ostringstream ostream_iterator output out of order
> > 
> > I compile and run following the program with stdcxx compiled 
> > from subversion
> > (svn update and compiled today) with Sun Studio 12 64 bit 
> > build mode 15D:
> [...]
> > I am wondering if I am doing something wrong, as the output is
> > out of order:
> 
>   This is a definitely bug in stdcxx library.
> 
>   I have created the corresponding issue:
> https://issues.apache.org/jira/browse/STDCXX-795
> 
>   Fixed thus: http://svn.apache.org/viewvc?rev=640831&view=rev
> 
>   Thanks for the report!
> 
> Farid.

-- 

RE: copy ostringstream ostream_iterator output out of order

Posted by Farid Zaripov <Fa...@epam.com>.
> -----Original Message-----
> From: Mark Wright [mailto:markwright@internode.on.net] 
> Sent: Tuesday, March 25, 2008 12:42 PM
> To: user@stdcxx.apache.org
> Subject: copy ostringstream ostream_iterator output out of order
> 
> I compile and run following the program with stdcxx compiled 
> from subversion
> (svn update and compiled today) with Sun Studio 12 64 bit 
> build mode 15D:
[...]
> I am wondering if I am doing something wrong, as the output is
> out of order:

  This is a definitely bug in stdcxx library.

  I have created the corresponding issue:
https://issues.apache.org/jira/browse/STDCXX-795

  Fixed thus: http://svn.apache.org/viewvc?rev=640831&view=rev

  Thanks for the report!

Farid.