R=rsc
DELTA=10 (1 added, 2 deleted, 7 changed)
OCL=22033
CL=22033
func New() *Vector {
v := new(*Vector);
v.nelem = 0;
- v.elem = new([10]Element);
+ v.elem = new([]Element, 10);
return v;
}
v.nelem++;
}
-type I struct { val int; }; // BUG: can't be local;
-
func main() {
+ type I struct { val int; };
i0 := new(*I); i0.val = 0;
i1 := new(*I); i1.val = 11;
i2 := new(*I); i2.val = 222;
func main() {
var ta []*T;
- ta = new([1]*T);
+ ta = *new(*[1]*T); // TODO: the first * shouldn't be necessary
ta[0] = nil;
}
/*
func main() {
v := new(*Vector);
- v.elem = new([10]Element);
+ v.elem = new([]Element, 10);
t := new(*TStruct);
t.name = "hi";
v.elem[0] = t;
type A []int;
func main() {
- var a [3]*A;
+ var a [3]A;
for i := 0; i < 3; i++ {
- a[i] = &A{i};
+ a[i] = A{i};
}
if a[0][0] != 0 { panic(); }
if a[1][0] != 1 { panic(); }
package main
func foo(a []int) int {
- return (*a)[0] // this seesm to do the wrong thing
+ return a[0] // this seems to do the wrong thing
}
func main() {
a := &[]int{12};
if x := a[0] ; x != 12 { panicln(1) }
if x := (*a)[0]; x != 12 { panicln(2) }
- if x := foo(a) ; x != 12 { panicln(3) } // fails (x is incorrect)
+ if x := foo(*a) ; x != 12 { panicln(3) } // fails (x is incorrect)
}
/*