Thread View: gnu.g++.lib.bug
1 messages
1 total messages
Started by Jason Merrill
Sun, 12 Apr 1992 05:22
ostream << hex problem in library, not compiler
Author: Jason Merrill
Date: Sun, 12 Apr 1992 05:22
Date: Sun, 12 Apr 1992 05:22
79 lines
3071 bytes
3071 bytes
In an earlier posting, I complained of the errors
Arraychar.c:121: type conversion required for type `ostream'
Arraychar.c:126: type conversion required for type `ostream'
caused by the code
void THIS::printOn(ostream& strm) const
{
strm.fill('0');
strm.width(2);
strm << hex;
for (register unsigned i=0; i<sz; i++) {
if (i > 0) strm << " ";
strm << "0x" << ((unsigned int)(unsigned char)v[i]);
}
strm << dec;
}
and said that the problem was that g++ was not converting ostream& to ios&
correctly. Looking at the library more closely, I realize that the problem
is not this, but rather that there is no insertor defined for type
ios& (*)(ios&). Diffs to iostream.h:
*** /gnu/libg++/libg++/iostream/iostream.h Wed Feb 26 12:29:47 1992
--- g++-include/iostream.h Sat Apr 11 22:16:20 1992
***************
*** 27,32
class istream; class ostream;
typedef istream& (*__imanip)(istream&);
typedef ostream& (*__omanip)(ostream&);
extern istream& ws(istream& ins);
extern ostream& flush(ostream& outs);
--- 27,33 -----
class istream; class ostream;
typedef istream& (*__imanip)(istream&);
typedef ostream& (*__omanip)(ostream&);
+ typedef ios& (*__iosmanip)(ios&);
extern istream& ws(istream& ins);
extern ostream& flush(ostream& outs);
***************
*** 77,82
extern ostream& operator<<(ostream&, float n);
extern ostream& operator<<(ostream&, double n);
inline ostream& operator<<(ostream& os, __omanip func) { return (*func)(os); }
extern ostream& operator<<(ostream&, streambuf*);
class istream : public ios
--- 78,85 -----
extern ostream& operator<<(ostream&, float n);
extern ostream& operator<<(ostream&, double n);
inline ostream& operator<<(ostream& os, __omanip func) { return (*func)(os); }
+ inline ostream& operator<<(ostream& os, __iosmanip func)
+ { (*func)(os); return os; }
extern ostream& operator<<(ostream&, streambuf*);
class istream : public ios
***************
*** 154,159
extern istream& operator>>(istream&, float&);
extern istream& operator>>(istream&, double&);
inline istream& operator>>(istream& is, __imanip func) { return (*func)(is); }
class iostream : public ios {
_G_size_t _gcount;
--- 157,164 -----
extern istream& operator>>(istream&, float&);
extern istream& operator>>(istream&, double&);
inline istream& operator>>(istream& is, __imanip func) { return (*func)(is); }
+ inline istream& operator>>(istream& is, __iosmanip func)
+ { (*func)(is); return is; }
class iostream : public ios {
_G_size_t _gcount;
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads