2018-03-08 15:19 GMT+01:00 Andrew Martin <andrew.thaddeus@gmail.com>:
[...] Some of the bytes in the word will have garbage in them. However, this could always be masked out with a bit mask (you have to know the platform endianness for this to work right). Is this safe? I doubt think this could ever cause a segfault but I wanted to check.

Before doing such things, please make sure that e.g. valgrind or similar tools are happy with such Kung-Fu. I don't know off the top of my head how fine-grained their checks are, but there is various similar code out there in the wild which is a PITA to debug. You might force people to add suppressions or even worse: Make some valuable tools totally useless. This is not something which should be done lightly...