After reading blog post : https://golang.org/ref/mem

I got one question, in the code below:


var c = make(chan int, 10)
var a string

func f() {
        a = "hello, world"
        c <- 0
}

func main() {
        go f()
        <-c
        print(a)
}


How can the complier knows that  a = "hello, world" happens  c <-0. Or 
could it possible that  c <-0 happens first, a = "hello, world" happens 
second ??

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/2257b529-ce46-4996-9497-c3190975c0c9%40googlegroups.com.

Reply via email to