On 27 November 2014 at 14:37, Maxim Uvarov <maxim.uva...@linaro.org> wrote:
> On 11/26/2014 08:31 PM, Maxim Uvarov wrote:
>>
>> To have compatibility with other compilers define custom
>> booalen type for odp.
>>
>> Signed-off-by: Maxim Uvarov <maxim.uva...@linaro.org>
>> ---
>>   platform/linux-generic/include/api/odp_std_types.h | 7 ++++---
>>   1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/platform/linux-generic/include/api/odp_std_types.h
>> b/platform/linux-generic/include/api/odp_std_types.h
>> index b12a2f3..e1f3971 100644
>> --- a/platform/linux-generic/include/api/odp_std_types.h
>> +++ b/platform/linux-generic/include/api/odp_std_types.h
>> @@ -27,9 +27,10 @@ extern "C" {
>>   #include <inttypes.h>
>>   #include <limits.h>
>>   -
>> -
>> -
>> +/** odp_bool type used for compatibility of boolean type in
>> + *  different compilers.
It's not necessary for compatibility with different compilers, we
could use stdbool.h for that (defined since C99 AFAIK).
We want the boolean type to have a well-defined and known size,
regardless which compiler is used as this facilities interoperability
between e.g. different compilers. Perhaps this is what you intended to
say.

>> + */
>> +typedef uint32_t odp_bool;
>
> odp_bool_t is better.
Yes.
But I would suggest the "standard" definition:
typedef int odp_bool_t;

>
> Can this be enum? I don't remember why we said that int is better then enum?
Now we are back in bool territory.
How large is an enum? Some compilers allow that to change, if the enum
range is small enough, a char or a short might be used instead of an
int.

>
> enum odp_bool_t {
>     ODP_FALSE = 0,
>     ODP_TRUE = 1,
> }
No need to define symbolic values for true and false. 0 means false,
non-zero means true, this is the semantics for conditionals in C. The
user can use whatever symbolic names they desire. stdbool.h false and
true can be used.

>
>
> Maxim.
>
>
>>     #ifdef __cplusplus
>>   }
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp

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

Reply via email to