> Yes, you could run into problems. sizeof(...) has unsigned type
> size_t, while i is a signed int. Thus the comparison
> (i < sizeof(struct pkthdr))
> is equivalent to
> ((size_t) i < sizeof(struct pkthdr)),
> unless there was some clandestine change of the C standard. Here, the
> problem is not that sizeof(...) is converted to signed int, but
> that i is converted to an unsigned type. This could lead to undesired
> consequences if we hadn't already handled the case i < 0.
but the quoted example handled i<0 properly. If you want to warn about
_possible_ breakage, we would end up emitting a warning for every pointer
dereference ;)
it's just like the uninitialized varibale warning stuff. Compiler should
check wether i<0 is possible at that point, if yes, maybe emit a warning.
-- mingo