This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC/Patch] libstdc++/14320 aka class type streamoff doesn't work :(
- From: Jonathan Wakely <cow at compsoc dot man dot ac dot uk>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: Paolo Carlini <pcarlini at suse dot de>, libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 1 Mar 2004 10:43:51 +0000
- Subject: Re: [RFC/Patch] libstdc++/14320 aka class type streamoff doesn't work :(
- References: <403F7C67.1080701@suse.de> <m3brnkwh9x.fsf@uniton.integrable-solutions.net> <403F8513.7040707@suse.de> <m3wu68uz8x.fsf@uniton.integrable-solutions.net>
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