Topic: iosflags should be a type (was: Outputting a float array and reading it back...)


Author: source@netcom.com (David Harmon)
Date: 1998/12/10
Raw View
On Tue, 08 Dec 1998 12:13:37 GMT, pnunn@melbpc.org.au (Peter Nunn)
wrote:

>THATS IT!!!
>
>I was using || between the binary and trunc instead of |.
>
>I have been looking for this for four days now.

You know, it's a damn shame stuff like this has to happen.  Didn't we
learn anything from C?  Why are the ios flags ints anyway?  They ought
to be a class type that implements the behaviour that is meaningful for
them, and DOESN'T let you use things like operator|| where you meant
operator| instead.  What is the use of type safety when you make
everything an int?


[ 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              ]






Author: ncm@nospam.cantrip.org (Nathan Myers)
Date: 1998/12/10
Raw View
David Harmon<source@netcom.com> wrote:
>pnunn@melbpc.org.au (Peter Nunn) wrote:
>>I was using || between the binary and trunc instead of |.
>>I have been looking for this for four days now.
>
>You know, it's a damn shame stuff like this has to happen.  Didn't we
>learn anything from C?  Why are the ios flags ints anyway?  They ought
>to be a class type that implements the behaviour that is meaningful for
>them, and DOESN'T let you use things like operator|| where you meant
>operator| instead.  What is the use of type safety when you make
>everything an int?

It's not an int.  The standard permits it to be implemented with an int,
but doesn't require it.  Better implementations use an enum.  Turning
off "backward-compatibility" flags on the build can improve type-safety
on implementations that would otherwise overload the functions that take
the enum with others that take an int.

--
Nathan Myers
ncm@nospam.cantrip.org  http://www.cantrip.org/



[ 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              ]