[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compilation error involving comparison and logical operator
On Fri, 2015-06-26 at 20:24 +0100, Dibyendu Majumdar wrote:
> On 26 June 2015 at 10:42, David Malcolm <dmalcolm@redhat.com> wrote:
> > Note that unlike C, libgccjit has no implicit type-coercion: anywhere
> > you want to treat int as bool or vice versa, or convert between float
> > and int, you need to do it explicitly via a cast
> > (gcc_jit_context_new_cast).
> >
>
> Couple of questions:
>
> 1. What is the type of a binary logical operator
By "a binary logical operator" presumably you mean the result of
gcc_jit_context_new_comparison. This has type GCC_JIT_TYPE_BOOL.
> and what effect does
> the result type in gcc_jit_context_new_binary_op() have?
This defines the type of the resulting rvalue. I believe you can use
this as another way of doing a cast.
> 2. What is the type of unary logical operator
It depends on the result_type passed in to gcc_jit_context_new_unary_op.
> and what is the effect
> of result type in gcc_jit_context_new_unary_op()?
This defines the type of the resulting rvalue. As above you can use
this as another way of doing a cast.
> The comparison operator does not take a result type so presumably it
> is always boolean?
Correct.