Hello,

Alex Vinokur wrote:

> This program has different behavior in
> * g++ 3.4.4 (Cygwin)
> * gpp 4.0.1 *Djgpp)
> * Microsoft C++ 13.00.9466

> Output for Microsoft C++
> -------------------
> rdstate() = 0x0; gcount() = 1500
> rdstate() = 0x0; gcount() = 1500
> rdstate() = 0x0; gcount() = 1500
> rdstate() = 0x0; gcount() = 1500
> rdstate() = 0x0; gcount() = 1500
> rdstate() = 0x3; gcount() = 1071
> rdstate() = 0x3
> -------------------

Output for g++ 4.1.0 as delivered with SuSE Linux 10.1

rdstate() = 0x0; gcount() = 1500
rdstate() = 0x0; gcount() = 1500
rdstate() = 0x0; gcount() = 1500
rdstate() = 0x0; gcount() = 1500
rdstate() = 0x0; gcount() = 1500
rdstate() = 0x6; gcount() = 1072
rdstate() = 0x6

So both Microsoft C++ agree on two bits set in the two final rdstate()
calls.

The 1072 instead of 1071 might be due to linefeed in the last line of
in.txt.

This following are two excerpts from the header files of g++-4.1.0:

  enum _Ios_Iostate
    {
      _S_goodbit                = 0,
      _S_badbit                 = 1L << 0,
      _S_eofbit                 = 1L << 1,
      _S_failbit                = 1L << 2,
      _S_ios_iostate_end = 1L << 16
    };

.....

    // 27.4.2.1.3  Type ios_base::iostate
    /**
     *  @brief This is a bitmask type.
     *
     *  @c "_Ios_Iostate" is implementation-defined, but it is valid to
     *  perform bitwise operations on these values and expect the Right
     *  Thing to happen.  Defined objects of type iostate are:
     *  - badbit
     *  - eofbit
     *  - failbit
     *  - goodbit
    */
    typedef _Ios_Iostate iostate;

So the 0x3 vs. 0x6 issue might be due to different coding of the bits.
It should be possible to verify this in the headers delivered with
Micorsoft C++.

Bernd Strieder

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to