DEV Community

Discussion on: Golang Writing memory efficient and CPU optimized Go Structs

Collapse
 
arpitvarshneya profile image
Arpit Varshneya • Edited

Didn't get why empty pad of 7 bytes, 7 bytes and 4 bytes respectively were added to make the sum of 8 bytes by complier? Why 8?

Collapse
 
deadlock profile image
Satyajiijt Roy

Because, the current version of the standard Go compiler, the alignment guarantees of other types may be either 4 or 8, depends on different build target architectures. This is also true for gccgo.