Using explicit pointer casts silences some compiler warnings that may introduce subtle bugs in the code. The union approach is the officially documented way of doing type punning, so there is no reason not to use it.