I'm reading a binary file in reverse order, using a while loop condition testing on the good() method. I was expecting a false condition when the seek eventually went before the first record. However my tests with:
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5) kept right on going!?!? This surprised me. Based on the references I've looked at, I expected a false return.
Is my understanding of the method incorrect, or does it appear that the compiler has a bug? Below is a sample program that demonstrates the problem.
Any thoughts would be appreciated.
// compiled with gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
// g++ -o tester test.cpp
/* testIn contents (cut and paste line into "inFile" file)
Seems I've answered my own question. I've just got access to a machine with Fedora installed. The compiler with fedora is: gcc version 4.3.0 20080428 (Red Hat 4.3.0-8) (GCC).
The test program runs as expected, and ends with good() returning false. So the problem has been fixed in a more recent g++ compiler.
Sorry for the noise. I hope someone else will benefit from this info.