Topic: Defect Report: Flawed setbase manipulator description


Author: Hyman Rosen <hymie@prolifics.com>
Date: 2000/03/01
Raw View
27.6.3/5 states

  smanip setbase(int base)

 Returns: An object s of unspecified type such that if out is an
 (instance of) basic_ostream then the expression out<<s behaves
 as if f(s) were called, in is an (instance of) basic_istream
 then the expression in>>s behaves as if f(s) were called. Where
 f can be defined as:

  ios_base& f(ios_base& str, int base)
  {
    // set basefield
    str.setf(n == 8 ? ios_base::oct :
    n == 10 ? ios_base::dec :
    n == 16 ? ios_base::hex :
      ios_base::fmtflags(0), ios_base::basefield);
    return str;
  }

There are two problems here. First, f takes two parameters, so the
description needs to say that out<<s and in>>s behave as if f(s,base)
had been called. Second, f is has a parameter named base, but is
written as if the parameter was named n.

Actually, there's a third problem. The paragraph has grammatical errors.
There needs to be an "and" after the first comma, and the "Where f"
sentence fragment needs to be merged into its preceding sentence. You
may also want to format the function a little better. The formatting
above is more-or-less what the Standard contains.


======================================= MODERATOR'S COMMENT:

[ moderator's note: Forwarded to C++ Committee. -sdc ]

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]