If there is for example a class that requires a pointer and a bool
. For simplicity an int
pointer will be used in examples, but the pointer type is
It's very portable, and furthermore, you can assert
when you accept the raw pointer to make sure it meets the alignment requirement. This will insure against the unfathomable future compiler that somehow messes you up.
Only reasons not to do it are the readability cost and general maintenance associated with "hacky" stuff like that. I'd shy away from it unless there's a clear gain to be made. But it is sometimes totally worth it.