Source file test/abi/return_stuff.go
1 // run 2 3 //go:build !wasm 4 // +build !wasm 5 6 // Copyright 2021 The Go Authors. All rights reserved. 7 // Use of this source code is governed by a BSD-style 8 // license that can be found in the LICENSE file. 9 10 // wasm is excluded because the compiler chatter about register abi pragma ends up 11 // on stdout, and causes the expected output to not match. 12 13 package main 14 15 import ( 16 "fmt" 17 ) 18 19 //go:registerparams 20 //go:noinline 21 func F(a, b, c *int) int { 22 return *a + *b + *c 23 } 24 25 //go:registerparams 26 //go:noinline 27 func H(s, t string) string { 28 return s + " " + t 29 } 30 31 func main() { 32 a, b, c := 1, 4, 16 33 x := F(&a, &b, &c) 34 fmt.Printf("x = %d\n", x) 35 y := H("Hello", "World!") 36 fmt.Println("len(y) =", len(y)) 37 fmt.Println("y =", y) 38 } 39