Re: Self-referential union?

2025-02-02 Thread Basile Starynkevitch
On Sun, 2025-02-02 at 16:45 +, Joe Finney wrote: > Is it straightforward to make a union that references itself? > > union u { > int x; > union u *p; > } > > With structs, I can use gcc_jit_context_new_opaque_struct, but there > doesn't seem to be an eq

Re: Self-referential union?

2025-02-02 Thread Joe Finney
Thanks for the response. > On most reasonable computers, every data pointer has the same size and > representation (so same size, same alignment, internally represented as some > "word" eg 64 bits). > > So you could at least make the libgccjit calls to build the equivalent of > > union u { >

Self-referential union?

2025-02-02 Thread Joe Finney
Is it straightforward to make a union that references itself? union u { int x; union u *p; } With structs, I can use gcc_jit_context_new_opaque_struct, but there doesn't seem to be an equivalent for unions.