Topic: Bitmask type oddities
Author: gennaro_prota@yahoo.com (Gennaro Prota)
Date: Sun, 10 Nov 2002 23:00:28 +0000 (UTC) Raw View
In several places the standard seems to miss the fact that
ios_base::iostate is not necessarily an integral type (17.3.2.1.2). In
regards to goodbit for instance:
a) 27.4.2.1.3/2 states:
Type iostate also defines the constant:
=97 goodbit, the value zero.
b) the example in 22.1.1/3 contains:
ios_base::iostate err =3D 0;
c) 27.6.1.2.2 has a similar line in normative text:
iostate err =3D 0;
I was about to submit a DR about this but then I stumbled upon the
proposed resolution of library issue 339
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#339
where the following definition is proposed
namespace std {
class ctype_base {
public:
typedef T mask;
// numeric values are for exposition only.
static const mask space =3D 1 << 0;
static const mask print =3D 1 << 1;
static const mask cntrl =3D 1 << 2;
...
};
}
Now, it's true that the comment says the values are for exposition
only but regardless of the specific values the code is ill-formed if
mask is an enum or a bitset; so, before submitting the DR and making a
fool of myself, I ask: is there anything I'm missing?
Genny.
---
[ 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://www.jamesd.demon.co.uk/csc/faq.html ]