{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/16309","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/16309/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/16309/comments","events_url":"https://api.github.com/repos/golang/go/issues/16309/events","html_url":"https://github.com/golang/go/issues/16309","id":164650404,"number":16309,"title":"cmd/cgo: C.malloc does not support comma error return values","user":{"login":"catalase","id":13768284,"avatar_url":"https://avatars.githubusercontent.com/u/13768284?v=3","gravatar_id":"","url":"https://api.github.com/users/catalase","html_url":"https://github.com/catalase","followers_url":"https://api.github.com/users/catalase/followers","following_url":"https://api.github.com/users/catalase/following{/other_user}","gists_url":"https://api.github.com/users/catalase/gists{/gist_id}","starred_url":"https://api.github.com/users/catalase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/catalase/subscriptions","organizations_url":"https://api.github.com/users/catalase/orgs","repos_url":"https://api.github.com/users/catalase/repos","events_url":"https://api.github.com/users/catalase/events{/privacy}","received_events_url":"https://api.github.com/users/catalase/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/golang/go/labels/NeedsDecision","name":"NeedsDecision","color":"ededed"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/38","html_url":"https://github.com/golang/go/milestones/Go1.8","labels_url":"https://api.github.com/repos/golang/go/milestones/38/labels","id":1709363,"number":38,"title":"Go1.8","description":"","creator":{"login":"griesemer","id":8528975,"avatar_url":"https://avatars.githubusercontent.com/u/8528975?v=3","gravatar_id":"","url":"https://api.github.com/users/griesemer","html_url":"https://github.com/griesemer","followers_url":"https://api.github.com/users/griesemer/followers","following_url":"https://api.github.com/users/griesemer/following{/other_user}","gists_url":"https://api.github.com/users/griesemer/gists{/gist_id}","starred_url":"https://api.github.com/users/griesemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/griesemer/subscriptions","organizations_url":"https://api.github.com/users/griesemer/orgs","repos_url":"https://api.github.com/users/griesemer/repos","events_url":"https://api.github.com/users/griesemer/events{/privacy}","received_events_url":"https://api.github.com/users/griesemer/received_events","type":"User","site_admin":false},"open_issues":271,"closed_issues":396,"state":"open","created_at":"2016-04-15T16:30:23Z","updated_at":"2016-10-24T16:12:24Z","due_on":"2017-01-31T00:00:00Z","closed_at":null},"comments":19,"created_at":"2016-07-09T05:12:28Z","updated_at":"2016-10-24T16:20:13Z","closed_at":null,"body":"Please answer these questions before submitting your issue. Thanks!\r\n\r\n1. What version of Go are you using (`go version`)?\r\n```\r\n$ go version\r\ngo version go1.6.2 windows/amd64\r\n```\r\n\r\n2. What operating system and processor architecture are you using (`go env`)?\r\n```\r\n$ go env\r\nset GOARCH=amd64\r\nset GOBIN=\r\nset GOEXE=.exe\r\nset GOHOSTARCH=amd64\r\nset GOHOSTOS=windows\r\nset GOOS=windows\r\nset GOPATH=C:\\Users\\Administrator\\Go\r\nset GORACE=\r\nset GOROOT=C:\\go\r\nset GOTOOLDIR=C:\\go\\pkg\\tool\\windows_amd64\r\nset GO15VENDOREXPERIMENT=1\r\nset CC=gcc\r\nset GOGCCFLAGS=-m64 -mthreads -fmessage-length=0\r\nset CXX=g++\r\nset CGO_ENABLED=1\r\n```\r\n\r\n3. What did you do?\r\n\r\nI ran `cgom.go` whose source is at https://play.golang.org/p/lFkVjkjn5W\r\n\r\n4. What did you expect to see?\r\n\r\nIn cgo manual (https://golang.org/cmd/cgo/), the manual states that\r\n\r\n> 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 (use _ to skip the result value if the function returns void). For example:\r\n\r\nI think C.malloc is C function. And Any C function may be called in a multiple assignemt context. Therefore, C.malloc should be called in a multiple assignment.\r\n\r\nThe idea was correct only if compilation would be successful.\r\n\r\n5. What did you see instead?\r\n\r\n```\r\n$ go run cgom.go\r\n# command-line-arguments\r\n.\\cgom.go:22:12: no two-result form for C.malloc\r\n```\r\n\r\nUnfortunately, reality is not. C.malloc cannot be used in that way, even though free function can be used in that way.\r\n\r\nC.malloc function seems not to be part of a set of C functions, because contraposition of \"Any C function may be called in a multiple assignment context\" is \"if a function may not be called in a multiple context, then the function is not C function\".\r\n\r\nThis contradicts usual idea that malloc should be C function. Go override some of special functions as malloc, etc. But these functions do not act like C functions.\r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/255789412","html_url":"https://github.com/golang/go/issues/16309#issuecomment-255789412","issue_url":"https://api.github.com/repos/golang/go/issues/16309","id":255789412,"user":{"login":"gopherbot","id":8566911,"avatar_url":"https://avatars.githubusercontent.com/u/8566911?v=3","gravatar_id":"","url":"https://api.github.com/users/gopherbot","html_url":"https://github.com/gopherbot","followers_url":"https://api.github.com/users/gopherbot/followers","following_url":"https://api.github.com/users/gopherbot/following{/other_user}","gists_url":"https://api.github.com/users/gopherbot/gists{/gist_id}","starred_url":"https://api.github.com/users/gopherbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gopherbot/subscriptions","organizations_url":"https://api.github.com/users/gopherbot/orgs","repos_url":"https://api.github.com/users/gopherbot/repos","events_url":"https://api.github.com/users/gopherbot/events{/privacy}","received_events_url":"https://api.github.com/users/gopherbot/received_events","type":"User","site_admin":false},"created_at":"2016-10-24T16:20:13Z","updated_at":"2016-10-24T16:20:13Z","body":"CL https://golang.org/cl/31811 mentions this issue."}}
{"actor":{"display_login":"gopherbot"}}