is there any way to instruct the go compiler to not inline?
$ cat primes.go
package main
import ("fmt")
func isPrime(p int) bool {
for i := 2; i < p; i += 1 {
for j := 2; j < p; j += 1 {
if i*j == p {
return false
}
}
}
return true
}
func main() {
for p := 2; p < 100; p+= 1 {
if isPrime(p) {
fmt.Println(p)
}
}
}
$ go build primes.go
$ objdump -D -S primes > primes.human
$ grep -rn "isPrime" primes.human
210091: if isPrime(p) {
the equivalent to gcc -O0
I guess - does it exist?