On Wed, 2020-09-09 at 12:50 +0200, Jan Mercl wrote: > On Wed, Sep 9, 2020 at 12:41 PM Dan Kortschak <d...@kortschak.io> > wrote: > > > I get the following > > > > ``` > > C alignof struct s: 8 > > Go alignof struct s: 8 > > Go alignof S: 8 > > ~/cznic $ go version > > go version go1.15.1 linux/arm64 > > ~/cznic $ uname -a > > Linux bildr 4.19.0-10-arm64 #1 SMP Debian 4.19.132-1 (2020-07-24) > > aarch64 GNU/Linux > > ``` > > > > I have an arm64 linux running on my pi, maybe the armv7l behaviour > > is > > different. > > Seems to be the case as armv7l is AFAIK a 32 bit only CPU. And arm64 > is next on the list of my targets so thank you for the information. > > But the question is still the same. Is it a bug or is my assumption > about Go and C agreeing on alignments/offsets invalid? I realizethe > specs say nothing in this regard.
What does cgo -godefs give you? On my amd64 and arm64 I get this: ``` ~/cznic $ cat main.go package main /* struct s { long long i; } x; */ import "C" type S struct { i int64 } type C_s C.struct_s ~/cznic $ go tool cgo -godefs main.go // Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs main.go package main type S struct { i int64 } type C_s struct { I int64 } ``` -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/bf4ba2bfde7a4a0c2d858e5ae1af8c118694b541.camel%40kortschak.io.