With -W4, sometimes (not always) I get:
xxx.c(1799): warning #2804: Consider changing type to 'size_t' for loop variable 'i'.
While I use for loop using int like:
int i;
for (i = 0 ; i < n ; ++i) {
res = foo( res );
}
...
Strictly speaking, it is not of course a bug, but I wonder why this warning appears.
What is the added value? I doubt using size_t makes code faster with all C compilers for simple loops.
size_t may not be the fastest integer type. I would use int_fastxx_t for example which is defined in stdint.h
Explanation is welcome.
Christian