[pulseaudio-discuss] Allowing anonymous structs and unions

Arun Raghavan arun at accosted.net
Fri Sep 25 02:54:52 PDT 2015


On 25 September 2015 at 15:21, Tanu Kaskinen <tanuk at iki.fi> wrote:
> On Thu, 2015-09-24 at 23:21 +0200, Ahmed S. Darwish wrote:
>> OK, after a second look, it seems that the anonymous structure indeed
>> does not provide any extra benefit. So I believe everyone now agrees
>> now that the following definitions are the most appropriate:
>>
>>     typedef struct {
>>         pa_mem mem;           /* Parent; must be first */
>>         int fd;
>>     } pa_memfd;
>>
>>     typedef struct {
>>         pa_mem mem;           /* Parent; must be first */
>>         int id;
>>         bool do_unlink;
>>     } pa_shm;
>>
>> Good :-)
>>
>> But I can't get my head around not using the anonymous unions, and
>> basically whether they provide any perceived disadvantage:
>
> I don't think Arun objected to the use of anonymous unions. I certainly
> don't see anything wrong with using anonymous unions in pa_mempool.

Yup, and I can see why I might have come off that way. I think this
pattern is fine.

Cheers,
Arun


More information about the pulseaudio-discuss mailing list