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. -- Ola On 28 November 2014 at 14:13, Taras Kondratiuk <[email protected]> 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 [email protected] http://lists.linaro.org/mailman/listinfo/lng-odp
