Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 187 for iota (0.04 sec)

  1. src/go/doc/testdata/examples/iota.go

    package foo_test
    
    const (
    	a = iota
    	b
    )
    
    const (
    	c = 3
    	d = 4
    )
    
    const (
    	e = iota
    	f
    )
    
    // The example refers to only one of the constants in the iota group, but we
    // must keep all of them because of the iota. The second group of constants can
    // be trimmed. The third has an iota, but is unused, so it can be eliminated.
    
    func Example() {
    	_ = b
    	_ = d
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 10 23:13:45 UTC 2022
    - 596 bytes
    - Viewed (0)
  2. src/go/doc/testdata/examples/iota.golden

    -- .Play --
    package main
    
    import ()
    
    const (
    	a = iota
    	b
    )
    
    const d = 4
    
    func main() {
    	_ = b
    	_ = d
    }
    -- 2.Play --
    package main
    
    import ()
    
    func main() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 10 23:13:45 UTC 2022
    - 158 bytes
    - Viewed (0)
  3. src/internal/types/testdata/check/const0.go

    		_p5 = assert(b3 == 42)
    	)
    }
    
    // iota
    const (
    	iota0 = iota
    	iota1 = iota
    	iota2 = iota*2
    	_a0 = assert(iota0 == 0)
    	_a1 = assert(iota1 == 1)
    	_a2 = assert(iota2 == 4)
    	iota6 = iota*3
    
    	iota7
    	iota8
    	_a3 = assert(iota7 == 21)
    	_a4 = assert(iota8 == 24)
    )
    
    const (
    	_b0 = iota
    	_b1 = assert(iota + iota2 == 5)
    	_b2 = len([iota]int{}) // iota may appear in a type!
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 17 19:54:25 UTC 2023
    - 9.2K bytes
    - Viewed (0)
  4. src/internal/types/testdata/check/constdecl.go

    const (
    	c = len([1 - iota]int{})
    	d
    	e // ERROR "invalid array length"
    	f // ERROR "invalid array length"
    )
    
    // Test that identifiers in implicit (omitted) RHS
    // expressions of constant declarations are resolved
    // in the correct context; see issues #49157, #53585.
    const X = 2
    
    func _() {
    	const (
    		A    = iota // 0
    		iota = iota // 1
    		B           // 1 (iota is declared locally on prev. line)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 31 16:11:16 UTC 2023
    - 3.7K bytes
    - Viewed (0)
  5. test/const8.go

    package main
    
    const X = 2
    
    func main() {
    	const (
    		A    = iota // 0
    		iota = iota // 1
    		B           // 1 (iota is declared locally on prev. line)
    		C           // 1
    	)
    	if A != 0 || B != 1 || C != 1 {
    		println("got", A, B, C, "want 0 1 1")
    		panic("FAILED")
    	}
    
    	const (
    		X = X + X
    		Y
    		Z = iota
    	)
    	if X != 4 || Y != 8 || Z != 1 {
    		println("got", X, Y, Z, "want 4 8 1")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 28 18:11:31 UTC 2022
    - 727 bytes
    - Viewed (0)
  6. test/fixedbugs/issue52438.go

    // license that can be found in the LICENSE file.
    
    package main
    
    const c1 = iota
    const c2 = iota
    
    const c3 = 0 + iota<<8
    const c4 = 1 + iota<<8
    
    func main() {
    	if c1 != 0 {
    		panic(c1)
    	}
    	if c2 != 0 {
    		panic(c2)
    	}
    
    	if c3 != 0 {
    		panic(c3)
    	}
    	if c4 != 1 {
    		panic(c4)
    	}
    
    	const c5 = iota
    	const c6 = iota
    
    	if c5 != 0 {
    		panic(c5)
    	}
    	if c6 != 0 {
    		panic(c6)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 19 23:20:21 UTC 2022
    - 489 bytes
    - Viewed (0)
  7. src/cmd/compile/internal/noder/codes.go

    const (
    	assignBlank codeAssign = iota
    	assignDef
    	assignExpr
    )
    
    // A codeDecl distinguishes among declaration encodings.
    type codeDecl int
    
    func (c codeDecl) Marker() pkgbits.SyncMarker { return pkgbits.SyncDecl }
    func (c codeDecl) Value() int                 { return int(c) }
    
    const (
    	declEnd codeDecl = iota
    	declFunc
    	declMethod
    	declVar
    	declOther
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 15 20:07:46 UTC 2023
    - 1.9K bytes
    - Viewed (0)
  8. src/internal/pkgbits/codes.go

    func (c CodeVal) Value() int         { return int(c) }
    
    // Note: These values are public and cannot be changed without
    // updating the go/types importers.
    
    const (
    	ValBool CodeVal = iota
    	ValString
    	ValInt64
    	ValBigInt
    	ValBigRat
    	ValBigFloat
    )
    
    // A CodeType distinguishes among go/types.Type encodings.
    type CodeType int
    
    func (c CodeType) Marker() SyncMarker { return SyncType }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 25 16:15:47 UTC 2022
    - 1.7K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/inline/inlheur/function_properties.go

    	// likewise.
    	FuncPropNeverReturns FuncPropBits = 1 << iota
    )
    
    type ParamPropBits uint32
    
    const (
    	// No info about this param
    	ParamNoInfo ParamPropBits = 0
    
    	// Parameter value feeds unmodified into a top-level interface
    	// call (this assumes the parameter is of interface type).
    	ParamFeedsInterfaceMethodCall ParamPropBits = 1 << iota
    
    	// Parameter value feeds unmodified into an interface call that
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Aug 10 18:52:53 UTC 2023
    - 3.7K bytes
    - Viewed (0)
  10. src/internal/pkgbits/reloc.go

    const (
    	PublicRootIdx  Index = 0
    	PrivateRootIdx Index = 1
    )
    
    const (
    	RelocString RelocKind = iota
    	RelocMeta
    	RelocPosBase
    	RelocPkg
    	RelocName
    	RelocType
    	RelocObj
    	RelocObjExt
    	RelocObjDict
    	RelocBody
    
    	numRelocs = iota
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Aug 10 22:22:48 UTC 2022
    - 835 bytes
    - Viewed (0)
Back to top