c - Strange pointer casting with void * -
we working on project embedded linux c , c++ together. recenty encountered unusual statement in function:
bool strangefunction(void* arg1, void* arg2, void* arg3) { (void)arg1; (void)arg2; (void)arg3; unsigned long keycode = (unsigned long)arg2; switch(keycode) { ...
i have 2 question in code above
what mean(void)arg1;
? is possible , ok utilize unsigned long keycode = (unsigned long)arg2;
if don't mind, need explanation , related links explaining subjects. thanks.
it quiet compiler warnings unused parameters.
it possible not portable. if on given platform address fits unsigned long
, it's fine. utilize uintptr_t
on platforms available create code portable.
c casting void-pointers
No comments:
Post a Comment