RE:CINT iostream

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Thu Aug 19 1999 - 23:12:29 MEST


Dear Christopher,

Thank you for reporting this problem. It turns out this is platform
dependent. I found strange behavior of ios::setf() in UNIX platforms.
Here is the solution. Please edit $CINTSYSDIR/include/iostream.h as
follows. You need to add unsetf() calls. This source is interpreted
so you do not need to recompile anything.

Thank you
Masaharu Goto


--------- $CINTSYSDIR/include/iostream.h from line 446 --------------
class G__CINT_HEX { int dmy; } hex;
ostream& operator<<(ostream& ostr,G__CINT_HEX& i) {
  ostr.unsetf(ios::dec);
  ostr.unsetf(ios::oct);
  ostr.setf(ios::hex);
  return(ostr);
}
istream& operator>>(istream& istr,G__CINT_HEX& i) {
  ostr.unsetf(ios::dec);
  ostr.unsetf(ios::oct);
  istr.setf(ios::hex);
  return(istr);
}

class G__CINT_DEC { int dmy; } dec;
ostream& operator<<(ostream& ostr,G__CINT_DEC& i) {
  ostr.unsetf(ios::hex);
  ostr.unsetf(ios::oct);
  ostr.setf(ios::dec);
  return(ostr);
}
istream& operator>>(istream& istr,G__CINT_DEC& i) {
  ostr.unsetf(ios::hex);
  ostr.unsetf(ios::oct);
  istr.setf(ios::dec);
  return(istr);
}

class G__CINT_OCT { int dmy; } oct;
ostream& operator<<(ostream& ostr,G__CINT_OCT& i) {
  ostr.unsetf(ios::hex);
  ostr.unsetf(ios::dec);
  ostr.setf(ios::oct);
  return(ostr);
}
istream& operator>>(istream& istr,G__CINT_OCT& i) {
  ostr.unsetf(ios::hex);
  ostr.unsetf(ios::dec);
  istr.setf(ios::oct);
  return(istr);
}

========================================================================
Could someone else try this and let me know if you get the same result,
so I can find out if it's just me or not.

root [1] int a=20;
root [2] cout << hex << a << endl;
20   (not 14 hex as expected)
root [3] cout.setf(ios::hex);
root [4] cout << a << endl;
20  (again not 14 hex as expected)

Using ROOT 2.22/10 with CINT 5.14.10 under Redhat 6.0.
Thanks.

P.S. If questions like this, about CINT, are not approved on this mail
list, let me know that too, so I can look elsewhere for an answer.

-- 
Christopher A. Stevens
Navigation/Data Reduction
Voice (301) 342-3181 x263 Fax   (301) 342-4745



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:38 MET