Here is my c code test:

drew@drew-PC MSYS /e/examples/c
$ cat align.c
#include <stdio.h>


typedef struct _A {
        char a;
        long long b;
} A;


int main() {
        printf("%d\n", sizeof(int*));
        printf("%d\n", sizeof(A));
}


drew@drew-PC MSYS /e/examples/c
$ gcc -o align align.c


drew@drew-PC MSYS /e/examples/c
$ ./align.exe
4
16

the gcc verison is:
$ gcc -v
Using built-in specs.
COLLECT_GCC=D:\msys64\mingw32\bin\gcc.exe
COLLECT_LTO_WRAPPER=D:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/
lto-wrapper.exe
Target: i686-w64-mingw32

Best regards,
xjdrew


On Friday, May 19, 2017 at 7:38:46 PM UTC+8, Jan Mercl wrote:
 

> On Fri, May 19, 2017 at 1:29 PM xjdrew <xj....@gmail.com <javascript:>> 
> wrote:
>
> > uint64 should aligin in 8 bytes, why it aligns in 4 bytes in 
> go1.8.1.linux-386?
>
>
> https://en.wikipedia.org/wiki/Data_structure_alignment#Typical_alignment_of_C_structs_on_x86
>
> > Could anyone tell me how I can get the same result with go playground?
>
> Why should the playground output the same results when the GOARCH and/or 
> GOOS differs?
>
> -- 
>
> -j
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to