Pelles C forum

C language => Beginner questions => Topic started by: Grincheux on February 20, 2016, 10:18:00 AM

Title: Waring 2804
Post by: Grincheux on February 20, 2016, 10:18:00 AM
Quote
C:\Users\Grincheux\Documents\Visual Studio 2015\Projects\ImagesViewer\md5.c(135): warning #2804: Consider changing type to 'size_t' for loop variable 'i'.

What does it mean.

It's a Pelle's warning. I have the two projects in the same folder. I compile for Pelle's and for MS.
Title: Re: Waring 2804
Post by: JohnF on February 20, 2016, 11:47:43 AM
size_t is unsigned - most people use int for a loop var so there is a possibility that it could  wrap around to a negative number.

Edit: and this

"The size_t type is the unsigned integer type that is the result of the sizeof operator (and the offsetof operator), so it is guaranteed to be big enough to contain the size of the biggest object your system can handle (e.g., a static array of 8Gb)."

John
Title: Re: Waring 2804
Post by: Grincheux on February 20, 2016, 12:38:05 PM
That's what I thought. Now I will see how MS like it, if not I will use the defined PELLES_C_COMPILER constant.
I downloaded an addin for Pelles which is very useful, it changes the program version each time I compile. Very good.
Title: Re: Waring 2804
Post by: TimoVJL on February 20, 2016, 01:31:45 PM
__POCC__ is useful for that too.

Code: [Select]
#ifdef __POCC__
#pragma warn(disable:2804)
#endif