News for hackers. Stuff that matters.
Re:C Puzzles by JoeAltmaier on Tuesday June 23, 2015 @08:21AM (#9764134)
Technically, it will print the first N bytes of the float as an int. Where N is the number of bytes ints compile to on the platform. So with knowledge of the platform, the result is entirely predictable.
Re:C Puzzles by adsche on Tuesday June 23, 2015 @08:51AM (#9764261)
Only with knowledge of platform AND compiler, though.

Also these are C puzzles and casting pointers to incompatible types and dereferencing them is undefined behavior. Using memcpy would indeed fix this according to e.g. [1].

[1] http://blog.llvm.org/2011/05/what-every-c-programmer-should-... (section "Violating Type Rules")