This is the mail archive of the gcc-patches@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: Remove some warnings


 > 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

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