This is the mail archive of the gcc-bugs@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]

iostream bug with fixed


I currently have libstdc++ with egcs-2.91.58 from 19981101. I notice
the following:

I have some C++ code like this:

#include <iostream>
using namespace std;
...
template <class T>
std::ostream& operator<<(std::ostream &s, const HMatrix<T> &A)
{
...
  s << fixed << setw(10) << setprecision(3) << A[i][j] << " ";
...
}

This code works with MS VC++ 5.0.  With egcs though I see:

homogmat.h:411: `fixed' undeclared (first use this function)
homogmat.h:411: (Each undeclared identifier is reported only once
homogmat.h:411: for each function it appears in.)
make: *** [mattest.o] Error 1

Changing the function to:

  s.setf(_IO_FIXED);
  s << setw(10) << setprecision(3) << A[i][j] << " ";

causes the expected fixed (non-scientific numbers) behavior.

 -Erik

--
Erik B. Andersen   Web:    http://www.inconnect.com/~andersen/ 
                   email:  andersee@debian.org
--This message was written using 73% post-consumer electrons--


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