gcc_jit_context_new_union_type()

Dibyendu Majumdar mobile@majumdar.org.uk
Thu Jan 1 00:00:00 GMT 2015


On 12 June 2015 at 21:47, David Malcolm <dmalcolm@redhat.com> wrote:
>> Should gcc_jit_context_new_union_type() return gcc_jit_struct* instead
>> of gcc_jit_type*?
>
> No, because you can't call
>   gcc_jit_struct_set_fields
> on a union type, only on the result of gcc_jit_context_new_opaque_struct
> (once).  Having new_union_type return a gcc_jit_type gives the compiler
> a way to warn about such a call.
>
> Is this something that you need to do?
>

Just trying to understand why there is a difference between:

extern gcc_jit_struct *
gcc_jit_context_new_struct_type (gcc_jit_context *ctxt,
gcc_jit_location *loc,
const char *name,
int num_fields,
gcc_jit_field **fields);

/* Unions work similarly to structs.  */
extern gcc_jit_type *
gcc_jit_context_new_union_type (gcc_jit_context *ctxt,
gcc_jit_location *loc,
const char *name,
int num_fields,
gcc_jit_field **fields);

Regards



More information about the Jit mailing list