This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Why fixing 9533 doesn't fix 7744: revealed!
Nathan Myers wrote:
The call to xsgetn is at the wrong level of abstraction. It keeps
trying until it gets n characters, or EOF. You want to call ::read()
in underflow(), and just go with as many characters as it returns.
(If it returns -1 and errno is EINTR you would call it again.)
Then, get rid of that isatty()!
Ok (too bad that I learned how to use some autoconf machinery for
something which was not going to last much ;)
To be honest, at the time Loren envisaged using read (and, at the time
I didn't realy understand that :) but had also some perplexities:
>... POSIX IO. Someone skilled in the art could construct a
>well-performing implementation of __basic_file<char>::xsgetn() that
>could return short-reads [e.g. fread() (stdio) will only return a
>short-read on error or EOF whereas read() (POSIX) will short-read
>based on the current line discipline]. It is possible that this
>alternate implementation should only be used when
>ios::sync_with_stdio(false) was called (since the only portable way to
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>share stdio buffers is to make stdio calls).
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Do you believe I can go ahead and safely change the underlying
implementation of xsgetn to use read instead of fread?
Paolo.