-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Description
What version of Go are you using (go version)?
$ go version go version go1.17.1 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/$USER/.cache/go-build" GOENV="/home/$USER/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/$USER/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/$USER/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.17.1" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/$USER/src/tailscale/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build84692255=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Tried to check the return code of a Windows syscall, known to be an HRESULT.
What did you expect to see?
I expect to be able to do things that I can typically do with HRESULTs in C++, like check if they are negative (equivalent to the Windows SDK's FAILED macro), or compare my hresult value to a known HRESULT error code without the compiler complaining about type mismatches.
In Microsoft's Windows SDK for C and C++, HRESULTs are typedef'd as LONG, which on Windows is always an int32. Further details as to why HRESULTs are not actually handles are outlined by Raymond Chen on his blog.
What did you see instead?
Compile errors due to type mismatches, because error codes for HRESULTs are defined as having type Handle, which in turn is defined as uintptr. Error codes for HRESULTs should be int32.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status