You can re-order the fields to get the desired effect:
https://go.dev/play/p/E1KTqVp0i-v

On Wed, Oct 12, 2022 at 6:01 PM Richiise Nugraha <richii...@gmail.com>
wrote:

> Hi, I am looking for zero-sized data type, something like Flexible Array
> Member.
> The size of `struct {}` is indeed zero, but for what reason when it's
> inside a struct with another member say (https://go.dev/play/p/DpydJIke7dS
> ):
>
> type C struct {
>     Pre   uint64
>     Inner struct{}
> }
>
> That struct sized for 16, while the sum of all member sizes is only 8,
> it's like there's hidden padding/align.
>
> Thanks!
> Nugraha
>
> --
> 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/2f7254a8-379a-4dc2-bf10-70ee7a209af2n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/2f7254a8-379a-4dc2-bf10-70ee7a209af2n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAEkBMfH1HsKCqX2KRqoiWui_s7RLJim4ownVtau-T7R_-YRosQ%40mail.gmail.com.

Reply via email to