This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: unbuffered input


Phil Edwards wrote:
> [let's move this off of gcc@ to libstdc++@, followups set]
> 
> 
> On Tue, May 21, 2002 at 06:48:07PM -0400, Phil Edwards wrote:
> 
>>In your first message you said you'd tried setbuf, by which I assume you mean
>>
>>    cin.rdbuf()->pubsetbuf(0,0);
>>
>>What happened?
> 
> 
> Actually, looking at basic_filebuf::setbuf(), I bet I can answer this:  Nothing.
> 
> We're supposed to be checking "whether any I/O has occurred on the stream,"
> according to the standard, but we're actually only checking whether the
> buffer is open.  And for cin's buffer, that will always be true.
> 
> So you're probably seeing a single character in the buffer all the time,
> 
>     "david rasmussen"  "c"                      "openhagen, denmark"
> 
> right?
> 

Yep!

I've wondered about this for a year now... I knew it was a bug in gcc.

So, will I have to file a problem report? When do you think this will be 
fixed, and more importantly, is there some sort of quick fix, either a 
workaround, or maybe a patch that will actually make the buffer work 
correctly?

/David



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