NO

Author Topic: Waring 2804  (Read 2191 times)

Grincheux

  • Guest
Waring 2804
« 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.

JohnF

  • Guest
Re: Waring 2804
« Reply #1 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
« Last Edit: February 20, 2016, 12:27:37 PM by JohnF »

Grincheux

  • Guest
Re: Waring 2804
« Reply #2 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.
« Last Edit: February 20, 2016, 01:12:33 PM by Grincheux »

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Waring 2804
« Reply #3 on: February 20, 2016, 01:31:45 PM »
__POCC__ is useful for that too.

Code: [Select]
#ifdef __POCC__
#pragma warn(disable:2804)
#endif
« Last Edit: February 20, 2016, 01:40:40 PM by TimoVJL »
May the source be with you