[Patch draft] Fix libstdc++/8610

Benjamin Kosnik bkoz@redhat.com
Tue Oct 21 14:56:00 GMT 2003


>So, here comes my first draft. Everything seems to work :), but I
>encourage your feedback for refining it. For instance, perhaps I'm
>being naive in checking if a value passed to 'lseek' doesn't
>overflow off_t like this:
>
>    if (__off != static_cast<off_t>(__off))
>
>???
>It works, but probably we can do better...

Yeah. No ideas on this, however. Maybe

numeric_limits<off_t>::max()?

>Also, is it safe to assume that a libc making available lseek64
>does also provide fopen64?

Not really. You should check for this as well. I suggest also, instead
of keying off of HAVE_INT64_T, HAVE_LSEEK64 that you check for all this
stuff in much the same way that _GLIBCXX_USE_WCHAR_T operates.

Ie, in configure test for  int64_t, lseek64, fopen64 and if they all succeed define

_GLIBCXX_USE_LFS 1

And then use this macro in the source files.

best,
benjamin



More information about the Libstdc++ mailing list