You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the cgo documentation: "Any C function (even void functions) may be called in a multiple assignment context to retrieve both the return value (if any) and the C errno variable as an error"
I was expecting var res, err = C.sqrt(1) to work but only res, err := C.sqrt(1) works.
var res, err = C.sqrt(1) fails at compile time with "assignment count mismatch: 2 = 1"
go version go1.6beta1 linux/amd64
Operating System (Virtual Box Guest): Linux 3.16.0-4-amd64 SMP Debian 3.16.7-ckt20-1+deb8u1 (2015-12-14) x86_64 GNU/Linux
ianlancetaylor
changed the title
cgo/errno - multiple assignment does not work with 'var'
cmd/cgo: multiple assignment to get errno value does not work with 'var'
Jan 13, 2016
According to the cgo documentation: "Any C function (even void functions) may be called in a multiple assignment context to retrieve both the return value (if any) and the C errno variable as an error"
I was expecting
var res, err = C.sqrt(1)
to work but onlyres, err := C.sqrt(1)
works.var res, err = C.sqrt(1)
fails at compile time with "assignment count mismatch: 2 = 1"go version go1.6beta1 linux/amd64
Operating System (Virtual Box Guest): Linux 3.16.0-4-amd64 SMP Debian 3.16.7-ckt20-1+deb8u1 (2015-12-14) x86_64 GNU/Linux
Ref golang-nuts: https://groups.google.com/forum/#!topic/golang-nuts/g88yZMHL_A0
main.go
The text was updated successfully, but these errors were encountered: