简单的代码递归和尾部
package main
import "fmt"
func TailRecursive(number int, product int) int {
product = product + number
if number == 1 {
return product
}
return TailRecursive(number-1, product)
}
func main() {
answer := TailRecursive(5, 0)
fmt.Printf("Recursive: %d\n", answer)
}
当我尝试工具编译时
go tool compile 6g -S ./g9.go > assembly.asm
我懂了
cat assembly.asm
6g:0:0: open 6g: no such file or directory
我的内核架构
x86_64 x86_64 x86_64 GNU/Linux
如何使用 go tool compile 获得正确的汇编输出?
ITMISS
相关分类