Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 23723 invoked from network); 28 Jun 2006 20:47:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Jun 2006 20:47:11 -0000 Received: (qmail 85855 invoked by uid 500); 28 Jun 2006 20:47:10 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 85727 invoked by uid 500); 28 Jun 2006 20:47:10 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 85703 invoked by uid 99); 28 Jun 2006 20:47:10 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Jun 2006 13:47:10 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Jun 2006 13:47:09 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 434B67141F9 for ; Wed, 28 Jun 2006 20:45:33 +0000 (GMT) Message-ID: <11381745.1151527533272.JavaMail.jira@brutus> Date: Wed, 28 Jun 2006 20:45:33 +0000 (GMT+00:00) From: "Martin Sebor (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Created: (STDCXX-241) std::istream::seekg problem (LWG issue 136) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N std::istream::seekg problem (LWG issue 136) ------------------------------------------- Key: STDCXX-241 URL: http://issues.apache.org/jira/browse/STDCXX-241 Project: C++ Standard Library Type: Bug Components: 27. Input/Output =20 Versions: 4.1.2, 4.1.3 =20 Environment: all Reporter: Martin Sebor Moved from the Rogue Wave bug tracking database: Class/File:=20 Fix Priority: Must Fix Long Description:=20 *** Nov 10 1999 9:33PM *** sebor *** Problem: seekg - problem see seek2.cpp: The ANSI/ISO-C++ document(ISO/IEC 14882:1998(E)) states about the effects o= f seekg: ANSI> Effects: If fail() !=3D true, executes rdbuf()=C3=AD>pubseekpos( pos)= . (The RW-Implementation instead executes rdbuf()->pubseekpos(pos, ios_base::= in);) pubseekpos calls seekpos which is declared: pos_type seekpos(pos_type sp, ios_base::openmode which =3D ios_base::in | ios_base::out); since the 2nd Argument (which) is not given in the above call of pubseekpos the value of the which-Argument is the default value ios_base::in | ios_bas= e::out. seekpos should alter both the position in the input and the output sequence= in this case. The RW-Implementation alters only the position in the input-sequence. Though the RW-implementation seems to be intuitivly right, it is formally not conforming. I think RogueWave should support the lwg issue No 136 described in http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-issues.html#136 TEST CASE: #include #include #include using namespace std; typedef basic_stringbuf, allocator > buffer; typedef basic_istream > input_stream; typedef char_traits traits; typedef char_traits::pos_type pos_type; #define VERIFY(p1,p2) verify(p1,p2,__LINE__) template void verify (T p1, T p2, int line) { if(p1 !=3D p2) { cerr << "line " << line << ": " << p1 << " should be "=20 << p2 << '\n'; } } template <> void verify (string p1, string p2, int line) { if(p1 !=3D p2) { cerr << "line " << line << ": \"" << p1 << "\" should be \""=20 << p2 << "\" \n"; } } int main() { const string expstr ("Rogue Wave"); buffer buf (expstr, ios_base::in | ios_base::out); typedef basic_iostream > iostrm;=20 =20 iostrm iostobj(&buf); char s[80]; =20 VERIFY ((void *)iostobj.rdbuf(),(void *)&buf); VERIFY (iostobj.gcount(),streamsize(0)); =20 iostobj >> s; VERIFY (string(s), string("Rogue")); iostobj.get (s, sizeof s); VERIFY (string(s), string(" Wave")); iostobj.clear (); iostobj.seekg (0, ios::end); iostobj.write (" Software", 9); iostobj.seekp (0); iostobj.get (s, sizeof s); iostobj.clear (); VERIFY (string(s), string("Rogue Wave Software")); } CC -c -mt -D_RWSTD_USE_CONFIG -I/amd/devco/sebor/dev/stdlib/include -I/buil= d/seb or/sunpro-5.8.j1-12d/include -I/amd/devco/sebor/dev/stdlib/examples/include= -li brary=3D%none -O +w t.cpp CC t.o -o t -library=3D%none -L/build/sebor/sunpro-5.8.j1-12d/lib -mt -L/= build/s ebor/sunpro-5.8.j1-12d/lib -lstd12d -lm line 55: " Software" should be "Rogue Wave Software"=20 --=20 This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira