[RFC/Patch] libstdc++/14320 aka class type streamoff doesn't work :(
Jonathan Wakely
cow@compsoc.man.ac.uk
Mon Mar 1 10:43:00 GMT 2004
On Fri, Feb 27, 2004 at 07:57:18PM +0100, Gabriel Dos Reis wrote:
> One of the testcase says that operator*= is not defined. Another
> wanted to insert or extract. It occurs to me that thr right course of
> action is to provide those instead of removing the class.
One issue that can't be fixed by providing the necessary operators is:
#include <ios>
struct A
{
static const std::streamoff n = 4;
};
I used to be able to use std::streamoff like this, e.g. to hold the
number of putback characters suported in my stream class, or the
buffer size. [*]
Unless std::streamoff is an integral type (in the builtin sense) then
in-class initialisation of static consts won't work. Should it?
It seems to me that the above code is legal, and not unreasonable, but
will fail on GCC 3.4 [**]
jon
[*]
I realise an unsigned type would work for this, but I need to compare
the value with the result of pointer arithmetic, and since streamoff
was prevously ptrdiff_t this seemed reasonable. I think I based the
code on an example in Langer & Kreft's IOStreams book.
[**]
I'm not arguing for the removal of the streamoff class, just raising a
real world issue that has affected me recently.
--
"A thing is not necessarily true because a man dies for it."
- Oscar Wilde
More information about the Libstdc++
mailing list