Fix inconsistent behavior in basic_ostream::seekp () and basic_istream::seekg ()
Marshall Clow
mclow.lists at gmail.com
Mon Oct 21 11:29:02 PDT 2013
Basically, each of these have two methods:
basic_ostream<charT,traits>& seekp(pos_type pos);
basic_ostream<charT,traits>& seekp(off_type off, ios_base::seekdir dir);
and one sets the failure bit of the stream on failure, and the other does not.
[ Note that the standard requires us to set the failure bit on the first call, and is silent on the second. I have opened an LWG issue to resolve this. ]
Make the second version set the failbit, and add tests.
Also, the ostream calls were lacking a sentry object.
For basic_istream, there were two calls, as well:
basic_istream<charT,traits>& seekg(pos_type pos);
basic_istream<charT,traits>& seekg(off_type off, ios_base::seekdir dir);
and they are both specified to set the failbit on failure, and only the first one did.
Fix that, and add a test to be sure.
-- Marshall
Marshall Clow Idio Software <mailto:mclow.lists at gmail.com>
A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
-- Yu Suzuki
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stream_seek.patch
Type: application/octet-stream
Size: 3387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131021/6cb19ef2/attachment.obj>
More information about the cfe-commits
mailing list