[RFC/Patch] libstdc++/14320 aka class type streamoff doesn't work :(

Gabriel Dos Reis gdr@integrable-solutions.net
Fri Feb 27 17:51:00 GMT 2004


Paolo Carlini <pcarlini@suse.de> writes:

| Hi,
| 
| libstdc++/14252 was only the tip of the iceberg: as pointed out by Pétur
| a few days ago:
| 
| "In fact the standard requires that difference_type provides those
| operators [24.1]:
| 
|    For every iterator type X for which equality is defined, there is a
|    corresponding signed integral type called the difference type of the
|    iterator."
| 
| this basically kills a class streamoff, and, if we really want to be
| picky, also kills LFS on 32 bit machines (where really matters, 64 bit
| machines have it automatically), since long long is not a C++ signed
| integral type (Pétur considers this a defect in the standard)
| 
| Thus the below: it seems to me that the best we can do for streamoff is
| essentially returning to what we had in 3_3. This implies giving away
| some type safety (i.e., some QoI) and also that the issue with LFS is
| still there, but otherwise seems OK. On glibc platforms we get an
| XPASS,
| since int64t is actually a typedef for long long.
| 
| What do you think?

I think, it is a complete nonstarter.

I also think that what should be fixed is the standard text.  The
meaning of "integral type" does not just affect this thing.  It also
usually pops up when people tries to use numeric_limits<>.  If you
have your own integer class and you cannot use numeric_limits<> to
tell that you intent it behaves like an integer, then that class is
pretty useless.

C99 has made an improvement by acknowledging that an integer type can
be an implementation-defined type that is not directly spelled in the
C99 standard.  C++ should do better, in stating in a more abtsract and
clearer way what is an integer, list what are the standard integer
types, and what a user-defined integer type may look like.

We can't have a useful tool to extend the collection of types involved
in a C++ program and yet adopt a myopic view of what an integer type is.   

In the meantime, I propose to retain the class you're removing in this
patch.  Removing this class would be the wrong thing to do.

-- Gaby



More information about the Libstdc++ mailing list