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]

Re: in_avail() error. Major compliance problem


In article <E15wsYD-0003VA-00@mail.oek.dk> you write:
> There is a problem with in_avail() in libstdc++ 3. I think it is a huge
> problem as lots and lots of existing, compliant code wont work as expected,
> and I suspect an easy fix, although I haven't checked myself. Example:
>
> #include <iostream> int main()
> {
>	std::cout << std::cin.rdbuf()->in_avail() << std::endl;
>	return 0;
> }

Hi David,

Stroustrup says on pg. 647 of TC++PL-SE that in_avail() is hard to
implement on some platforms.  From this, I assume that a portable
solution that works in all cases is somewhat hard.

According to my reading of Stroustrup, always returning 0 would be
better than hanging until input is available but I do believe that the
current behavior complies with the ISO-C++99 standard but lacks a
certain QoI (quality of implementation) that the 2.95.3 implementation
had.  If you believe that the problem is easy to fix or you are
willing to put some effort into it, then I invite you to provide a
patch to libstdc++@gcc.gnu.org which addresses the QoI issue.  Your
solution must be portable or at least correctly configurable based on
autoconf checks.

Regards,
Loren


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