[IOStreams] Is such a behaviour considered as bug

Hello *,
I really enjoyed working with Iostreams, while testing some of my
components. Using IOStreams with array_device seemed to be a very powerfull
approach to test some of my stream based algorithms. But currently I face
some issues which seem to be really weired to me. I produced some code
snippet to better explain it. I used Boost.Test library to verify my
assumptions.
using namespace boost;
namespace io=boost::iostreams;
typedef unsinged char byte;
typedef array

On 11 August 2011 14:22, Ovanes Markarian
If the defined stream is only 2 bytes long why is 2 a valid stream position?
There needs to be an offset for the end of the stream. I'm actually not sure if it should be -1 for larger values though.
Why is eof always false? Do you think this behavior is buggy?
IIRC in streams eof is only set when you try to read past the end of the file.

Hello Daniel,
thanks for your answers. Please see my answers below.
On Fri, Aug 12, 2011 at 11:37 PM, Daniel James
To be honest, I do not understand what offset do you mean here. Why does
array_device needs an offset for the end of stream and stringstream does
not? I looked up the behavior in the standard (for stringstream, since I
assume array_device should behave similar in regards of positioning and
memory related nature of stringstream) and there is clearly written that
seeking to an invalid pos will cause tellg to return -1. I would propose to
change the array_device to be more consistent with stringstream in these
regards.
In Standard C++ IOStreams and Locales by A. Langer & K. Kreft is also stated
for basic_istream
Yes, you are right. I double checked this in the Standard. As the my upper answer points out, the stream should be in the failed state. Many thanks for your time, Ovanes
participants (2)
-
Daniel James
-
Ovanes Markarian