On 28 November 2014 at 14:41, Bill Fischofer <bill.fischo...@linaro.org> wrote:
> ODP supports C and as such all normal C idioms apply.  False is 0 and true
> is != false.  I don't see a need to overspecify beyond that.  For ODP
> routines that return an odp_bool_t they return 1 for true.
Agree. I was not perfectly clear below.

>
> On Fri, Nov 28, 2014 at 8:25 AM, Ola Liljedahl <ola.liljed...@linaro.org>
> wrote:
>>
>> In C conditional expressions (as used by if, for, while, ? ), any
>> non-zero value means true so yes you can pass "2" to indicate true.
>> Using "true" or "TRUE" enums or preprocessor symbols that evaluate to
>> "1" is just to enhance readability and understanding (at least that's
>> the hope but then we're having this conversation...).
>>
>> "#define TRUE 1" (or the corresponding enum definition) does not mean
>> that *only* "1" represents true.
>>
>> If the ODP specification mentions (specifies) that *only* 1 can be
>> used as true, then this is wrong in my opinion and should be changed.
I meant for input (e.g. function parameters) here. For output (e.g.
functions returning boolean values), we should do as Bill specified
above and return 1.

>>
>> -- Ola
>>
>>
>> On 28 November 2014 at 14:13, Taras Kondratiuk
>> <taras.kondrat...@linaro.org> wrote:
>> > On 11/28/2014 02:42 PM, Bill Fischofer wrote:
>> >>
>> >> Not really.  int has been used for booleans for some time and the 0 =
>> >> false, 1 = true convention is well established.  The purpose of enums
>> >> is
>> >> to support remapping.  Under no circumstances would one expect to see
>> >> some platform define ODP_TRUE to be anything other than 1 or ODP_FALSE
>> >> to be anything other than 0.  So in this case an enum is just adding
>> >> syntactic clutter for no benefit.
>> >
>> >
>> > In this case purpose of enums is not remapping, but value validation.
>> >
>> > In different parts of our specification we have true = 1 or true = !0.
>> > So it is not clear if '2' can be passed as 'true' to a function that had
>> > odp_bool_t argument. If true is exactly 1, then it would be more
>> > clear to see ODP_TRUE as input value.
>
>

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to