public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
* Reflection for unions
@ 2021-12-12 19:53 Marc Nieper-Wißkirchen
  2021-12-15  8:49 ` Marc Nieper-Wißkirchen
  0 siblings, 1 reply; 2+ messages in thread
From: Marc Nieper-Wißkirchen @ 2021-12-12 19:53 UTC (permalink / raw)
  To: jit

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Reflection for unions
  2021-12-12 19:53 Reflection for unions Marc Nieper-Wißkirchen
@ 2021-12-15  8:49 ` Marc Nieper-Wißkirchen
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Nieper-Wißkirchen @ 2021-12-15  8:49 UTC (permalink / raw)
  To: Marc Nieper-Wißkirchen; +Cc: jit

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
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-15  8:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-12 19:53 Reflection for unions Marc Nieper-Wißkirchen
2021-12-15  8:49 ` Marc Nieper-Wißkirchen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).