News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Waring 2804

Started by Grincheux, February 20, 2016, 10:18:00 AM

Previous topic - Next topic

Grincheux

QuoteC:\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.

JohnF

#1
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

Grincheux

#2
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.

TimoVJL

#3
__POCC__ is useful for that too.

#ifdef __POCC__
#pragma warn(disable:2804)
#endif
May the source be with you