Re: C++: istream.eof on gcc 4.6

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22 April 2011 02:49, Hugo Arregui wrote:
> Hi guys,
>
> today I find a change on istream.eof when I upgrade from 4.5.2 to 4.6.0.
>
> Here's a little example showing the change, this code will show "true,
> true" using gcc 4.5.2 (and previous), and "true, false" using 4.6:
>
> I don't know if it's a bug, or some expected change, or even if i'm
> wrong blaming gcc. Can you confirm that?
>
> -----
> The code:
>
> #include <iostream>
> #include <sstream>
>
> using namespace std;
>
> static bool is_next_char_readable(istream& file)
> {
>    file.get();
>    const bool result = file.eof();
>    file.unget();
>    return result;
> }
>
> int main()
> {
>    istringstream s("test");
>    s.seekg(0, ios_base::end);
>    std::cout << is_next_char_readable(s) << std::endl;
>    std::cout << is_next_char_readable(s) << std::endl;
>    return 0;
> }
>
Probably due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26211
which fixed some defect reports in the standard



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux