With regards the size of the struct, elements are aligned by the go
compiler automatically as demonstrated by the following tool:
http://golang-sizeof.tips/
Are you asking why the compiler doesn't automatically change the order
of fields in the struct to make the struct a minimal size?
Regards
Steve
On 06/03/2019 12:56, Viktor Packhuchyi wrote:
Hi,
As I know Go compiler provide self-managed alignment for fields
inside a structure.
I don't understand why the fields order must impact additional
allocations.
It's not clear for me, why the compiler doesn't manage this
automatically.
Is this a future which I can't understand or a design gap?
--
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
<mailto:golang-nuts+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
--
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.