Suppose we have a struct "message_t":
message_t *msg;
If a function returns a void pointer can we simply assign the address to msg, or do we need to cast the pointer?:
void *data;
msg = data;
I've seen cases where "data" would be cast to message_t
, however this doesn't seem entirely necessary, so in which situations would you do this?
Surely the pointer type (message_t) should be enough to tell the compiler how to dereference the pointer (i.e. how many bytes the first variable in the struct needs, etc).
Let me know if my question isn't clear.