Debian Codegraph @

test/abi/return_stuff.go

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