2015-08-12 09:30:47 +00:00
|
|
|
// Copyright 2015 The go-python Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package pointers
|
|
|
|
|
|
|
|
//type SPtr *S
|
2015-08-14 11:02:17 +00:00
|
|
|
|
2015-08-12 09:30:47 +00:00
|
|
|
type S struct {
|
|
|
|
Value int
|
|
|
|
}
|
|
|
|
|
|
|
|
// Inc increments the value of s
|
|
|
|
func Inc(s *S) {
|
|
|
|
s.Value++
|
2015-08-14 11:02:17 +00:00
|
|
|
}
|
|
|
|
|
2019-03-06 10:41:03 +00:00
|
|
|
// note: pointers to basic types are not supported -- would
|
|
|
|
// require a handle -- could to, but probably not worth it..
|
2015-08-14 11:02:17 +00:00
|
|
|
type MyInt int
|
|
|
|
|
|
|
|
// IncInt increments an integer
|
|
|
|
func IncMyInt(i *MyInt) {
|
|
|
|
(*i)++
|
|
|
|
}
|
|
|
|
|
|
|
|
// IncInt increments an integer
|
|
|
|
func IncInt(i *int) {
|
|
|
|
(*i)++
|
2015-08-12 09:30:47 +00:00
|
|
|
}
|