And just a general thing: I strongly recommend
NOT getting into the habit of force-casting just to alleviate warnings (or errors if those warnings are used with
-Werror). Force-casting should only be done when the programmer fully understands why the situation is happening and that it is truly safe to force the type.
In my experience, I'd say 80% of the time, people force-cast to relieve warnings and create new problems (buffer overflows, or ranging issues (suddenly a value the program internally expects to range from 0-4294967295 now is limited to -2147483648-2147483647 for example)) just to "relieve warnings". I cannot tell you how often I see people do this -- as often as I see people saying "just ignore warnings".
Bottom line with C programming: always treat warnings as errors, and do not resort to force-casting unless you FULLY understand the implications of what you're changing.
Footnote:
size_t and (especially)
time_t are two typedefs which I have hated for almost 20 years. I wish they would die horrible, horrible deaths already. I know we were talking about pointer sizes earlier, but I am a strong proponent of fixed-width integer types via ISO C99 and
inttypes.h;
uint64_t,
int8_t, etc. Just Make Sense(tm) and always guarantee you get what you expect. Classic "generic" types (int, char, long, etc.) never sat well with me. But that's probably because I'm an assembler programmer at heart. For an example of proper use of these,
check out my bsdhwmon project.