This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Remove some warnings
- To: aj at suse dot de
- Subject: Re: Remove some warnings
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Fri, 12 Jan 2001 17:38:08 -0500 (EST)
- Cc: bernds at redhat dot com, gcc-patches at gcc dot gnu dot org
> From: Andreas Jaeger <aj@suse.de>
>
> >>>>> Bernd Schmidt writes:
>
> > On 12 Jan 2001, Andreas Jaeger wrote:
> >> > Isn't it possible for sizeof to return a signed type on some
> >> > hosts? Maybe this is better fixed with casts in the for
> >> > statements?
> >>
> >> It is possible - but ISO C99 demands size_t as result.
>
> > Maybe i should be declared as size_t then. (I know this sort of
> > thing was discussed once, I just have forgotten what the
> > conclusion was :-)
>
> I don't remember either. But with size_t being 64 bits on a 64 bit
> platform, I prefer an int that's in general 32 bits (or is this a
> disadvantage) - we're discussing the loop variable here.
>
> Andreas
If the warning if coming from comparison against a sizeof, (which has
a type of size_t) then the loop variable should IMHO be a size_t also.
That's the convention I've been following.
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions