This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Tweak unbuffered overflow, provide unbuffered seek testcases


On Wed, Jun 11, 2003 at 11:30:22PM +0200, Paolo Carlini wrote:
> Unfortunately seekpos testing revealed that unbuffered
> overflow has to be slightly more complicated than we hoped, as
> this excerpt from seekpos/char/4-io.cc shows:
> 
>    c1 = fb_03.snextc();         //current in pointer +1
>    VERIFY( c1 == 't' );
>    c2 = fb_03.sputc('\n');      //test current out pointer

This is not valid code.  Or, rather, c2 should be EOF after this,
and there is no need to write or store the '\n'...

> Before actually doing unbuffered sputc (overflow, that is), we
> must rewind -1, since the last underflow (upon snextc) led to
> a file descriptor one position after 't'. Note that the
> same rewind action is needed in the buffered case.

It's not required to support writing after reading without
an intervening seek.  It's not our responsibility to do the seek.
(That's the user's job.)  Instead, we should just return EOF.

Nathan Myers
ncm-nospam@cantrip.org
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]