octave delimited stream peek function

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

octave delimited stream peek function

Rik-4
jwe,

I just fixed https://savannah.gnu.org/bugs/?56917, but it was incredibly
painful to find the root cause.  It turns out that the peek function for a
delimited_stream in oct-stream.cc does NOT necessarily return or set the
EOF indication when at the end of the file.  This is contrary to the C++
input stream behavior which returns what the next get() operation would
return (which in this case would be EOF).  I put a FIXME note in
oct-stream.cc, but is this a behavior that we are actually relying on and
want to keep?  I can't say for sure because I know there was a lot of
buffer optimization to support textscan() functionality.

--Rik

Reply | Threaded
Open this post in threaded view
|

Re: octave delimited stream peek function

John W. Eaton
Administrator
On 9/17/19 8:06 PM, Rik wrote:

> I just fixed https://savannah.gnu.org/bugs/?56917, but it was incredibly
> painful to find the root cause.  It turns out that the peek function for a
> delimited_stream in oct-stream.cc does NOT necessarily return or set the
> EOF indication when at the end of the file.  This is contrary to the C++
> input stream behavior which returns what the next get() operation would
> return (which in this case would be EOF).  I put a FIXME note in
> oct-stream.cc, but is this a behavior that we are actually relying on and
> want to keep?  I can't say for sure because I know there was a lot of
> buffer optimization to support textscan() functionality.

I don't know the answer to that as I am not the original author of the
textscan function in C++.  Even if I were, I don't know that I would
remember enough of the details at this point anyway.

jwe