What is the usage of that zero-sized data type? Can you give an example 
where that Inner field has any usage?

On Wednesday, October 12, 2022 at 7:27:14 PM UTC+2 
[email protected] wrote:

> 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 <[email protected]> 
> 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 [email protected].
>> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a7883ea8-4850-4cc8-831d-571a088fccf1n%40googlegroups.com.

Reply via email to