This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: in_avail() error. Major compliance problem
- To: gcc at gcc dot gnu dot org
- Subject: Re: in_avail() error. Major compliance problem
- From: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- Date: Mon, 29 Oct 2001 21:05:15 -0600 (CST)
- Cc: pinkfloydhomer at yahoo dot com
- Organization: Networks and Infrastructure Lab (IL02/2240), Motorola Labs
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