File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
internal/examples/basic/structs Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -10,14 +10,15 @@ import (
1010// MemoryPadding は、構造体メンバーの定義順によってGoランタイムがメモリ上にパディングを挿入することを確認するサンプルです.
1111func 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+ }
You can’t perform that action at this time.
0 commit comments