On Wed, Sep 2, 2026, 12:49 PM ron minnich <[email protected]> wrote:

> Thierry, is your comment re the first struct member address aligning to
> the struct address still true in a world in which many C compilers
> randomize struct layout? I'm guessing not.
>
>
> On Wed, Sep 2, 2026 at 7:30 AM <[email protected]> wrote:
>
>> On Wed, Sep 02, 2026 at 10:13:51AM +0200, Shawn Rutledge wrote:
>> >
>> > Lack of shared data structure implementations is one of the main
>> downsides to C.  What?s your favorite workaround?
>> 
>> But since it is a guaranteed that the first member of a structure is
>> at the same address as the structure, one can cast to a shared
>> structure given as the first member of extended or overloaded
>> structures.
>> --
>> Thierry Laronde <tlaronde +AT+ kergis +dot+ com>
>>              http://www.kergis.com/
>>             http://kertex.kergis.com/
>> Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C
> *9fans <https://9fans.topicbox.com/latest>* / 9fans / see discussions
> <https://9fans.topicbox.com/groups/9fans> + participants
> <https://9fans.topicbox.com/groups/9fans/members> + delivery options
> <https://9fans.topicbox.com/groups/9fans/subscription> Permalink
> <https://9fans.topicbox.com/groups/9fans/Td859d3c6cefc922f-M926bbc407c719f7457cb68ac>
>


I think they are referring to embedded structures in P9 C? E.g.

Struct foo{
  Int i
}
Struct bar{
  foo
  Int j
}

Then pass foo or bar structures to a function that takes foo.


------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Td859d3c6cefc922f-M37b1ecb97c6259da2e17f5f4
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to