3 ms·
> Why does it store a 0 Go language semantics define that variables receive a zero initialization.[0] > and then a 1 in "$ret0"? The 1 is because the code ex
by loeg 9y ago
> Why does it store a 0
Go language semantics define that variables receive a zero initialization.[0]
> and then a 1 in "$ret0"?
The 1 is because the code explicitly stores a 1 :-).
Clearly the output code has not been through an optimization pass.
[0]: https://gobyexample.com/variables https://gobyexample.com/variables
- zeusk 9y agobut if you look at the code, there isn't a "variable" to be initialized - the function is supposed to return a constant/literal one.