This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: some 64-bit-ness in libio




Note that this approach won't work for 64 bit NT because they have defined
sizeof(long) == sizeof(int) < sizeof(pointer)

I know that an itanium port for gcc is in the works but don't know if there
are plans to target NT.  In the interest of portability use of an intptr_t
cast would probably be best.  A warning about the conversion of the 0
(positive constant) is kind of silly seeming, although I see why there
would be a warning for the -1 conversion.  Does a 64 bit gcc give warnings
for both of these?

Peeter

> While trying the testsuite on the latest GCC snapshot on an alpha
> machine, I noticed that a lot of the tests fail because of an int
> to pointer conversion warning in the libio/streambuf.h file.
>
> I don't know if this is the correct fix, but I'd like to propose
> the following patch.
>
> Regards,
>                                         Christian
>
> --- libio/streambuf.h.chris     Thu May  4 16:22:11 2000
> +++ libio/streambuf.h   Thu May  4 16:22:53 2000
> @@ -219,7 +219,7 @@ class ios : public _ios_fields {
>      int fail() const { return _state & (ios::badbit|ios::failbit); }
>      int bad() const { return _state & ios::badbit; }
>      iostate rdstate() const { return _state; }
> -    operator void*() const { return fail() ? (void*)0 : (void*)(-1); }
> +    operator void*() const { return fail() ? (void*)0L : (void*)(-1L); }
>      int operator!() const { return fail(); }
>      iostate exceptions() const { return _exceptions; }
>      void exceptions(iostate enable) {



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]