You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2007/08/22 16:34:31 UTC
[jira] Commented: (STDCXX-522) std::filebuf::overflow(EOF) writes
EOF to file in unbuffered mode
[ https://issues.apache.org/jira/browse/STDCXX-522?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12521798 ]
Martin Sebor commented on STDCXX-522:
-------------------------------------
See the following thread for a patch and a discussion of it:
http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg04351.html
> std::filebuf::overflow(EOF) writes EOF to file in unbuffered mode
> -----------------------------------------------------------------
>
> Key: STDCXX-522
> URL: https://issues.apache.org/jira/browse/STDCXX-522
> Project: C++ Standard Library
> Issue Type: Bug
> Components: 27. Input/Output
> Affects Versions: 4.1.4, 4.1.3
> Reporter: Martin Sebor
>
> The program below should run successfully to completion but instead it aborts (both in 4.1.3 and on trunk):
> $ cat t.cpp && make t && LD_LIBRARY_PATH=../lib ./t
> #include <cassert>
> #include <fstream>
> #include <ios>
> int main ()
> {
> struct: std::filebuf {
> int_type overflow (int_type c) {
> return std::filebuf::overflow (c);
> }
> } buf;
> buf.open ("file", std::ios::out);
> buf.pubsetbuf (0, 0);
> buf.overflow (std::filebuf::traits_type::eof ());
> buf.close ();
> std::ifstream in ("file");
> assert (std::istream::traits_type::eof () == in.get ());
> }
> gcc -c -I/amd/devco/sebor/stdcxx-4.1.3/include/ansi -D_RWSTDDEBUG -pthread -D_RWSTD_USE_CONFIG -I/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/include -I/amd/devco/sebor/stdcxx-4.1.3/include -I/amd/devco/sebor/stdcxx-4.1.3/examples/include -pedantic -nostdinc++ -g -m64 -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align t.cpp
> gcc t.o -o t -pthread -m64 -L/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/lib -lstd15D -lsupc++ -lm
> t: t.cpp:19: int main(): Assertion `std::istream::traits_type::eof () == in.get ()' failed.
> Aborted
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.