"Illegal" does not mean that such program is expected to always fail. Something bad may happen, but may not, depending on other conditions. In your case, the value at the address in a variable p is a constant string, so it's pretty likely that that's still there when fmt.Println is called, but it's not guaranteed, so you shouldn't rely on that.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Wednesday, May 21, 2014 5:03:11 PM UTC-4, Rui Ueyama wrote:I'm aware of why, it's just that the release notes say: "Programs that use package unsafe to store uintptrs in pointer values are illegal and will crash if the runtime detects the behavior"."Illegal" does not mean that such program is expected to always fail. Something bad may happen, but may not, depending on other conditions. In your case, the value at the address in a variable p is a constant string, so it's pretty likely that that's still there when fmt.Println is called, but it's not guaranteed, so you shouldn't rely on that.