On Thu, Feb 27, 2025 at 05:09:18PM +0200, Andy Shevchenko wrote: > On Thu, Feb 27, 2025 at 11:58:24AM +0000, Ding, Shenghao wrote: > > > From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> > > > Sent: Tuesday, February 25, 2025 10:41 PM > > > On Tue, Feb 25, 2025 at 10:03:16PM +0800, Shenghao Ding wrote: ... > Then in the loop you do the following (just an example, can be done > differently): > > union { > const char name[20]; > > struct fct_param_alias_u8 *u8; > struct fct_param_alias_u24 *u24; Sorry, these should be not the pointers. > ... > const void *data; and this is not needed, as we have to use the pointer to the union itself. > } a; } *a; > a.data = data; a = data; > if (!strncmp(a.name, ..., sizeof(a.name))) > foo = ...(a.u24->book, a.u24->page, a.u24->offset); if (!strncmp(a->name, ..., sizeof(a->name))) foo = ...(a->u24.book, a->u24.page, a->u24.offset); > else if (...) > ... -- With Best Regards, Andy Shevchenko