#strict aliasing
19 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
yes
it's ultimately through int*, the step in the middle is pointless
what you're doing is accessing an object of type float through a pointer to int, that's never valid
alright thx
std::bit_cast, std::memcpy
memcpy would make it legal ?
yeah
because i do it byte per byte ?
it might also be valid to use std::start_lifetime_as to begin the lifetime of an int in the storage of the float
yeah, you're allowed to read and write to object bytes of trivial types however you like
oh wait this question is for C, so no std::start_lifetime_as then I guess
so just memcpy and union then, where union is only a valid approach in C