Fix inconsistent behavior in basic_ostream::seekp () and basic_istream::seekg ()
Marshall Clow
mclow.lists at gmail.com
Wed Oct 30 14:58:32 PDT 2013
On Oct 21, 2013, at 11:29 AM, Marshall Clow <mclow.lists at gmail.com> wrote:
> 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.
Howard pointed out an unnecessary test in the ostream code.
Fixed that.
The LWG issue referred to above is: http://cplusplus.github.io/LWG/lwg-active.html#2341
-- 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-2.patch
Type: application/octet-stream
Size: 3351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131030/aa49c477/attachment.obj>
More information about the cfe-commits
mailing list