Return-Path: Delivered-To: apmail-stdcxx-issues-archive@locus.apache.org Received: (qmail 95086 invoked from network); 6 Jun 2008 04:53:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Jun 2008 04:53:21 -0000 Received: (qmail 57246 invoked by uid 500); 6 Jun 2008 04:53:21 -0000 Delivered-To: apmail-stdcxx-issues-archive@stdcxx.apache.org Received: (qmail 57231 invoked by uid 500); 6 Jun 2008 04:53:21 -0000 Mailing-List: contact issues-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list issues@stdcxx.apache.org Received: (qmail 57220 invoked by uid 99); 6 Jun 2008 04:53:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jun 2008 21:53:21 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Jun 2008 04:52:23 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id E61D4234C131 for ; Thu, 5 Jun 2008 21:52:44 -0700 (PDT) Message-ID: <1300113871.1212727964928.JavaMail.jira@brutus> Date: Thu, 5 Jun 2008 21:52:44 -0700 (PDT) From: "Martin Sebor (JIRA)" To: issues@stdcxx.apache.org Subject: [jira] Updated: (STDCXX-241) [LWG #136] std::istream::seekg problem 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 [ https://issues.apache.org/jira/browse/STDCXX-241?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Sebor updated STDCXX-241: -------------------------------- Description:=20 Moved from the Rogue Wave bug tracking database: {noformat} 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 {noformat} was: 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 Fix Version/s: (was: 4.2.2) 4.3 LWG issue 136 is still Open. Deferred until 4.3 (if the LWG issue is resolv= ed then). > [LWG #136] std::istream::seekg problem > -------------------------------------- > > Key: STDCXX-241 > URL: https://issues.apache.org/jira/browse/STDCXX-241 > Project: C++ Standard Library > Issue Type: Bug > Components: 27. Input/Output > Affects Versions: 4.1.2, 4.1.3, 4.1.4, 4.2.0, 4.2.1 > Environment: all > Reporter: Martin Sebor > Fix For: 4.3 > > Original Estimate: 4h > Remaining Estimate: 4h > > Moved from the Rogue Wave bug tracking database: > {noformat} > 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= of seekg: > ANSI> Effects: If fail() !=3D true, executes rdbuf()=C3=AD>pubseekpos( po= s). > (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 pubseekp= os > the value of the which-Argument is the default value ios_base::in | ios_b= ase::out. > seekpos should alter both the position in the input and the output sequen= ce 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/bu= ild/seb > or/sunpro-5.8.j1-12d/include -I/amd/devco/sebor/dev/stdlib/examples/inclu= de -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 > {noformat} --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.