News for hackers. Stuff that matters.
Re:With Undefined Behavior, Anything Is Possible by jancsika on Saturday August 18, 2018 @06:05PM (#17791059)
To be clear, the use case I have in mind has a soft realtime performance requirements.

So I only see two options:

1. Use memcpy, blindly hope that gcc optimizes it to the same bitmath I'm currently using, and blindly hope that gcc supports that optimized path for the foreseeable future.

2. Use the union type-punning trick, and blindly hope gcc supports their extension for the foreseeable future.

#1 above requires me to blindly hope twice, whereas #2 requires only one instance of blind hope. Furthermore, I already know how the blind hope of gcc optimizing memcpy into bitmath turns out-- gcc does not optimize it in this way.

So I cannot see any alternative to relying on the union type-punning trick in this case.

Edit: clarification

There are no comments on this comment yet.