Skip to content

Commit e9974f1

Browse files
committed
Update example
1 parent cae0c50 commit e9974f1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

internal/examples/basic/structs/struct_memory_padding.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ import (
1010
// MemoryPadding は、構造体メンバーの定義順によってGoランタイムがメモリ上にパディングを挿入することを確認するサンプルです.
1111
func MemoryPadding() error {
1212
var (
13-
notGood = types.MemoryPadding{}
14-
good = types.NoMemoryPadding{}
13+
notGood = types.MemoryPadding{} // メモリのパディングが発生する構造体
14+
good = types.NoMemoryPadding{} // メモリのパディングが発生しない構造体
1515
)
1616

17-
output.Stdoutl("[Padding 発生]", unsafe.Sizeof(notGood))
17+
output.Stdoutf("[Padding 発生]", "%d byte(s)\n", unsafe.Sizeof(notGood))
1818
output.Stdoutl("", notGood.Layout())
19-
output.Stdoutl("[Padding なし]", unsafe.Sizeof(good))
19+
output.StdoutHr()
20+
output.Stdoutf("[Padding なし]", "%d byte(s)\n", unsafe.Sizeof(good))
2021
output.Stdoutl("", good.Layout())
2122

2223
return nil
23-
}
24+
}

0 commit comments

Comments
 (0)