I'm really confused.
uint8_t hash[20];
uint32_t u;
// Setting hash to some value here...
u = *(uint32_t*) hash;
This *(uint32_t*) hash
causes a warning:
Dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
.
I think it's something wrong in typecasting, but I'm not sure, because I don't clearly know on how *(type*) var
way of typecasting actually works. It seem to point on an object with an asterisk inside too. I am confused, that's the thing which forces me to ask a question about that.
Especially I'd like to know how type*
differs from *(type*)
. This may be a lot of help to get rid of this warning.
Thanks in advance.