Discussion on runtime/compiler meeting: Struct packing/reordering

134 views
Skip to first unread message

محمد بومنذر

unread,
Mar 21, 2024, 7:47:23 PM3/21/24
to golang-nuts
Hello,

I have been following the Go Runtime and Compiler team meeting notes for a while. In the recent notes, I noticed something that got my attention regarding memory layout optimization for structures. 

I'm working on some code that interfaces with C libraries without directly utilizing the CGo tool (for portability reasons). Currently, I'm adding padding fields manually for C structs like
struct {a int32; _ [4]byte}

Would this behavior be affected?

Ian Lance Taylor

unread,
Mar 21, 2024, 8:35:05 PM3/21/24
to محمد بومنذر, golang-nuts
‪On Thu, Mar 21, 2024 at 4:47 PM ‫محمد بومنذر‬‎
Exactly because of this concern there is a proposal https://go.dev/issue/66408.

Ian
Reply all
Reply to author
Forward
0 new messages