My main concern is that this is undefined behaviour.