Reflection for unions

Marc Nieper-Wißkirchen marc.nieper+gnu@gmail.com
Wed Dec 15 08:49:07 GMT 2021


PS This is also related to the question of how to forward-declare a union
in libgccjit as in:

union foo;

struct bar
{
  union foo *ptr;
};

union foo
{
  struct bar *bar;
};

Currently, one can solve this problem by wrapping the union in a
one-field-struct but this is inconvenient and possibly makes optimization
more difficult.

Am So., 12. Dez. 2021 um 20:53 Uhr schrieb Marc Nieper-Wißkirchen <
marc.nieper+gnu@gmail.com>:

> We have structs and unions in libgccjit. While structs have their own
> internal type, gcc_jit_struct, this doesn't seem to be the case for unions.
> This makes me wonder whether reflection is possible for union types. For
> structs, we have, for example, gcc_jit_struct_get_field.
>
> What is the reason for the different treatment of structs and unions?
>
> Thanks,
>
> Marc
>


More information about the Jit mailing list