Files
llgo/cl/_testlibc/defer/in.go

18 lines
282 B
Go
Raw Normal View History

2024-06-11 10:35:27 +08:00
package main
import "github.com/goplus/llgo/c"
2024-06-11 10:35:27 +08:00
func f(s string) bool {
return len(s) > 2
}
func main() {
2024-06-12 23:17:10 +08:00
c.GoDeferData()
2024-06-11 10:35:27 +08:00
if s := "hello"; f(s) {
defer c.Printf(c.Str("%s\n"), c.AllocaCStr(s))
} else {
defer c.Printf(c.Str("world\n"))
}
defer c.Printf(c.Str("bye\n"))
}