Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: extra zero initialization in &T{} #15391

Closed
randall77 opened this issue Apr 20, 2016 · 2 comments
Closed

cmd/compile: extra zero initialization in &T{} #15391

randall77 opened this issue Apr 20, 2016 · 2 comments

Comments

@randall77
Copy link
Contributor

type T struct {
    a, b int
}
func f() *T {
    return new(T)
}
func g() *T {
    return &T{}
}

f just calls newobject and returns the result.
g calls newobject, writes two zeros to the result, then returns it. Those zero writes are unnecessary.

@randall77 randall77 added this to the Go1.8 milestone Apr 20, 2016
@ghost
Copy link

ghost commented Apr 20, 2016

Previously reported here: #15199

@randall77
Copy link
Contributor Author

Closing as duplicate.

@golang golang locked and limited conversation to collaborators Apr 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants