It's typically safe without any guarantee.
As mentioned in @axe 's answer.
It's okay if any impl of string stores as a sequential character array, but it's not a standard guarantee.