- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 3,434 for defer1 (0.11 sec)
-
test/defererrcheck.go
func f2() { for { defer func() { // ERROR "heap-allocated defer" fmt.Println("defer1") }() if glob > 2 { break } } defer func() { // ERROR "stack-allocated defer" fmt.Println("defer2") }() } func f3() { defer func() { // ERROR "stack-allocated defer" fmt.Println("defer2") }() for { defer func() { // ERROR "heap-allocated defer" fmt.Println("defer1") }() if glob > 2 {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Feb 26 16:54:17 UTC 2020 - 1.4K bytes - Viewed (0) -
test/escape.go
_, p = out_escapes(15) _, q = out_escapes(16) chk(p, q, 15, "out_escapes") _, p = out_escapes_2(17) _, q = out_escapes_2(18) chk(p, q, 17, "out_escapes_2") x := defer1(20) if x != 20 { println("defer failed", x) bad = true } if bad { panic("BUG: no escape") }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Mar 06 18:34:24 UTC 2023 - 3.8K bytes - Viewed (0) -
src/runtime/runtime_test.go
for i := 0; i < b.N; i++ { defer1() } } func defer1() { defer func(x, y, z int) { if recover() != nil || x != 1 || y != 2 || z != 3 { panic("bad recover") } }(1, 2, 3) } func BenchmarkDefer10(b *testing.B) { for i := 0; i < b.N/10; i++ { defer2() } } func defer2() { for i := 0; i < 10; i++ { defer func(x, y, z int) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 01:00:11 UTC 2024 - 11.7K bytes - Viewed (0) -
src/cmd/cgo/internal/testerrors/ptr_test.go
fail: false, }, { // Check deferred pointers when they are used, not // when the defer statement is run. name: "defer1", c: `typedef struct s28 { int *p; } s28; void f28(s28 *ps) {}`, body: `p := &C.s28{}; defer C.f28(p); p.p = new(C.int)`, fail: true, }, { // Check a pointer to a union if the union has any // pointer fields.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Aug 03 16:07:49 UTC 2023 - 21.2K bytes - Viewed (0) -
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/defers/defers.go
Requires: []*analysis.Analyzer{inspect.Analyzer}, URL: "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/defers", Doc: analysisutil.MustExtractDoc(doc, "defers"), Run: run, } func run(pass *analysis.Pass) (interface{}, error) { if !analysisutil.Imports(pass.Pkg, "time") { return nil, nil } checkDeferCall := func(node ast.Node) bool { switch v := node.(type) { case *ast.CallExpr:
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Oct 19 23:33:33 UTC 2023 - 1.4K bytes - Viewed (0) -
test/defer.go
// license that can be found in the LICENSE file. // Test defer. package main import "fmt" var result string func addInt(i int) { result += fmt.Sprint(i) } func test1helper() { for i := 0; i < 10; i++ { defer addInt(i) } } func test1() { result = "" test1helper() if result != "9876543210" { fmt.Printf("test1: bad defer result (should be 9876543210): %q\n", result) panic("defer")
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Feb 12 18:17:49 UTC 2013 - 875 bytes - Viewed (0) -
src/runtime/panic.go
) // We have two different ways of doing defers. The older way involves creating a // defer record at the time that a defer statement is executing and adding it to a // defer chain. This chain is inspected by the deferreturn call at all function // exits in order to run the appropriate defer calls. A cheaper way (which we call // open-coded defers) is used for functions in which no defer statements occur in
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed May 29 17:58:53 UTC 2024 - 43.8K bytes - Viewed (0) -
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/defers/doc.go
// Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package defers defines an Analyzer that checks for common mistakes in defer // statements. // // # Analyzer defers // // defers: report common mistakes in defer statements // // The defers analyzer reports a diagnostic when a defer statement would // result in a non-deferred call to time.Since, as experience has shown
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Sep 25 20:06:48 UTC 2023 - 763 bytes - Viewed (0) -
src/runtime/stack_test.go
func deferHeapAndStack(n int) (r int) { if n == 0 { return 0 } if n%2 == 0 { // heap-allocated defers for i := 0; i < 2; i++ { defer func() { r++ }() } } else { // stack-allocated defers defer func() { r++ }() defer func() { r++ }() } r = deferHeapAndStack(n - 1) escapeMe(new([1024]byte)) // force some GCs return }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Jun 14 00:03:57 UTC 2023 - 23.1K bytes - Viewed (0) -
src/runtime/defer_test.go
defer step(t, &steps, 9) step(t, &steps, 8) }() func() { defer step(t, &steps, 13) defer step(t, &steps, 12) func() { defer step(t, &steps, 11) panic(4) }() // Code below isn't executed, // but removing it breaks the test case. defer func() {}() defer panic(-1) defer step(t, &steps, -1) defer step(t, &steps, -1) defer func() {}() }()
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Sep 20 18:57:24 UTC 2023 - 11.4K bytes - Viewed (0)