]> Cypherpunks repositories - gostls13.git/commitdiff
few more Sizeof.
authorRuss Cox <rsc@golang.org>
Tue, 17 Feb 2009 21:40:28 +0000 (13:40 -0800)
committerRuss Cox <rsc@golang.org>
Tue, 17 Feb 2009 21:40:28 +0000 (13:40 -0800)
R=r
DELTA=3  (0 added, 1 deleted, 2 changed)
OCL=25106
CL=25106

src/lib/reflect/type.go

index f0585f069dbfdba3997d9b99e5bae2edeb993089..31de06ce42148b0614f9182d3e47a626c08170b3 100644 (file)
@@ -107,7 +107,7 @@ func newBasicType(name string, kind int, size int) Type {
 // Prebuilt basic types
 var (
        Missing = newBasicType(missingString, MissingKind, 1);
-       DotDotDot = newBasicType(dotDotDotString, DotDotDotKind, 16);   // TODO(r): size of interface?
+       DotDotDot = newBasicType(dotDotDotString, DotDotDotKind, unsafe.Sizeof(true.(interface{})));
        Bool = newBasicType("bool", BoolKind, unsafe.Sizeof(true));
        Int = newBasicType("int", IntKind, unsafe.Sizeof(int(0)));
        Int8 = newBasicType("int8", Int8Kind, 1);
@@ -124,8 +124,7 @@ var (
        Float32 = newBasicType("float32", Float32Kind, 4);
        Float64 = newBasicType("float64", Float64Kind, 8);
        Float80 = newBasicType("float80", Float80Kind, 10);     // TODO: strange size?
-       // TODO(rsc): Sizeof("") should work, doesn't.
-       String = newBasicType("string", StringKind, unsafe.Sizeof(string(0)));
+       String = newBasicType("string", StringKind, unsafe.Sizeof(""));
 )
 
 // Stub types allow us to defer evaluating type names until needed.