Commit d0424faf authored by Russ Cox's avatar Russ Cox

few more Sizeof.

R=r
DELTA=3  (0 added, 1 deleted, 2 changed)
OCL=25106
CL=25106
parent 3c0fc400
...@@ -107,7 +107,7 @@ func newBasicType(name string, kind int, size int) Type { ...@@ -107,7 +107,7 @@ func newBasicType(name string, kind int, size int) Type {
// Prebuilt basic types // Prebuilt basic types
var ( var (
Missing = newBasicType(missingString, MissingKind, 1); 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)); Bool = newBasicType("bool", BoolKind, unsafe.Sizeof(true));
Int = newBasicType("int", IntKind, unsafe.Sizeof(int(0))); Int = newBasicType("int", IntKind, unsafe.Sizeof(int(0)));
Int8 = newBasicType("int8", Int8Kind, 1); Int8 = newBasicType("int8", Int8Kind, 1);
...@@ -124,8 +124,7 @@ var ( ...@@ -124,8 +124,7 @@ var (
Float32 = newBasicType("float32", Float32Kind, 4); Float32 = newBasicType("float32", Float32Kind, 4);
Float64 = newBasicType("float64", Float64Kind, 8); Float64 = newBasicType("float64", Float64Kind, 8);
Float80 = newBasicType("float80", Float80Kind, 10); // TODO: strange size? Float80 = newBasicType("float80", Float80Kind, 10); // TODO: strange size?
// TODO(rsc): Sizeof("") should work, doesn't. String = newBasicType("string", StringKind, unsafe.Sizeof(""));
String = newBasicType("string", StringKind, unsafe.Sizeof(string(0)));
) )
// Stub types allow us to defer evaluating type names until needed. // Stub types allow us to defer evaluating type names until needed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment