[RFC] Large file iostreams

Benjamin Kosnik bkoz@redhat.com
Thu Oct 16 17:28:00 GMT 2003


>> >The standard requires in several places that streamoff must be a
>> >typedef, so it is defined as
>> >  typedef class __streamoff streamoff;
>> 
>> Bummer, this.
>
>Yes, it doesn't seem to serve any real purpose.

..and there doesn't seem to be a way to test that streamoff is not a
typedef, and instead a type via class defined in std. Why should we
bother with the __streamoff bits when it can be class streamoff? 

>However, there are very few valid reasons for extracting the
>streamoff from a fpos (except when overriding
>basic_streambuf::seekpos), so I think the constructor should remain
>explicit until somebody complains. Also, the extracted value is
>meaningless in general for wfilebuf, and useless without the state
>when using stateful encodings.

Yes, I agree, it's just that this is a (significant) change in behavior
so we should note it. 

>The attached patch passes the testsuite. It differs from the last
>version in that operators ++ and -- have been added to streamoff,
>to make testsuite/27_io/objects/char/10.cc pass. 

You could just use int there... but I don't really care. 

Anyway. Let's move streamsize and streamoff into postypes.h, as well as
streamoff_base_type. See the patch I sent last night. That way all these
types are consolidated into one file.

> Also implementation
>defined behaviour in streamoff and fpos is documented (that is all
>behaviour in streamoff and fpos, except for fpos::state()).
>
>Note: Due to lack of current autotools, makefile bits are both
>incomplete and untested.
>
>Petur
>
>2003-10-15  Petur Runolfsson  <peturr02@ru.is>
>
>	PR libstdc++/8610
>	PR libstdc++/11450
>	PR libstdc++/11543
>	PR libstdc++/12065
>	* config/linker-map.gnu: Add __streamoff.
>	* config/io/basic_file_stdio.cc (__basic_file::seekoff):
>	Change return value from streampos to streamoff.
>	(__basic_file::seekpos): Delete.
>	* config/io/basic_file_stdio.h: Same.
>	* config/io/c_io_stdio.h: Add __streamoff_base_type typedef,
>	remove streamoff and wstreamsize typedefs.
>	* config/os/generic/fpos.h: Remove.
>	* config/os/gnu-linux/fpos.h: Remove.
>	* include/Makefile.am (bits_headers): Add bits/postypes.h.
>	* include/bits/char_traits.h: Include bits/postypes.h instead of
>	bits/fpos.h.
>	* include/bits/fstream.tcc (basic_filebuf::open,
>	basic_filebuf::pbackfail): Don't use < or >= to compare pos_type
>	values, use == and != instead.
>	(basic_filebuf::_M_seek): Use explicit conversion from streamoff
>	to pos_type.
>	(basic_filebuf::imbue):  Don't use ! on pos_type values, use
>	== instead. Don't use __check_facet(_M_codecvt) unless is_open().
>	* include/bits/postypes.h: New file.
>	(streamoff, streampos, wstreampos): Define typedefs, with
>	streamoff defined as...
>	(__streamoff): New class. Document implementation defined
>	aspects.
>	(fpos): New implementation. Document implementation defined
>	aspects.
>	* include/bits/sstream.tcc (basic_stringbuf::seekpos): Use
>	explicit conversion from pos_type to off_type.
>	* include/std/std_iosfwd.h: Include bits/postypes.h instead
>	of bits/fpos.h.
>	* testsuite/27_io/basic_filebuf/seekoff/char/1-in.cc: Use
>	explicit conversion from pos_type to off_type.
>	* testsuite/27_io/basic_filebuf/seekoff/char/1-io.cc: Same.
>	* testsuite/27_io/basic_filebuf/seekoff/char/1-out.cc: Same.	
>	* testsuite/27_io/basic_filebuf/seekoff/char/11543.cc: New test.
>	* testsuite/27_io/basic_filebuf/seekoff/char/2-in.cc: Use
>	explicit conversion from pos_type to off_type.
>	* testsuite/27_io/basic_filebuf/seekoff/char/2-io.cc: Same.
>	* testsuite/27_io/basic_filebuf/seekoff/char/2-out.cc: Same.	
>	* testsuite/27_io/basic_filebuf/seekoff/wchar_t/11543.cc: New test.
>	* testsuite/27_io/basic_filebuf/seekpos/char/1-in.cc: Use
>	explicit conversion from pos_type to off_type.
>	* testsuite/27_io/basic_filebuf/seekpos/char/1-io.cc: Same.
>	* testsuite/27_io/basic_filebuf/seekpos/char/1-out.cc: Same.	
>	* testsuite/27_io/basic_filebuf/seekpos/char/2-in.cc: Same.
>	* testsuite/27_io/basic_filebuf/seekpos/char/2-io.cc: Same.
>	* testsuite/27_io/basic_filebuf/seekpos/char/2-out.cc: Same.
>	* testsuite/27_io/basic_istream/seekg/char/2.cc: Same.
>	* testsuite/27_io/basic_stringbuf/seekoff/char/1.cc: Same.	
>	* testsuite/27_io/basic_stringbuf/seekpos/char/1.cc: Same.
>	* testsuite/27_io/fpos/11450.cc: New test.
>	* testsuite/27_io/fpos/mbstate_t/12065.cc: New test.
>	* testsuite/27_io/fpos/mbstate_t/3.cc: Use explicit conversion
>	from streampos to streamoff.
>	* testsuite/27_io/fpos/mbstate_t/4_neg.cc: New test.
>	* testsuite/27_io/types/3.cc: New test.
>
>



More information about the Libstdc++ mailing list