Skip to content
UPEEC

Strict Aliasing

The compiler assumes pointers of unrelated types don't point to the same object.

Advanced
Comments 0

Reading a float through a uint32_t * is UB. Use memcpy(&u, &f, sizeof u) (optimised away) or a union to reinterpret bytes. char * may alias anything.

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.