Symphilosophein 狂者進取,狷者有所不為也。
Never create an unaligned pointer of the struct type.
Its UB to convert from one pointer with less alignment guarantees to another with more, if the underlying pointer is not aligned.
Everything that happens after that is UB, including arithmetic.
Reference:https://eel.is/c++draft/expr.static.cast#12
Note: Only a member of this blog may post a comment.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.