U-boot-1.1.6-2008R1到vdsp5(bf561)的移植记录(9):bool的问题

VDSP5中Bool类型的冲突
本文探讨了在VDSP5编译环境下,U-Boot源码中Bool类型的定义与VDSP5内置类型之间的冲突问题。由于VDSP5将False和True作为内置类型处理,直接在代码中使用这些关键字即可,因此U-Boot中的自定义Bool类型定义显得多余并导致编译错误。文章建议注释掉这部分代码以解决该问题。
 
  
在u-boot/include/asm/posix_type.h中有这样一个定义:
typedef enum { false = 0, true = 1 } bool;
但是在VDSP5中将引起一个错误:
"../../include/asm/posix_types.h", line 63: cc0040: error: expected an
          identifier
 typedef enum { false = 0, true = 1 } bool;
因为VDSP5是将false和true做为内置类型来处理的:
The bool, true, and false keywords are extensions that support the C++ boolean type in C mode. The bool keyword is a unique signed integral type, just as the wchar_t is a unique unsigned type. There are two built-in constants of this type: true and false. When converting a numeric or pointer value to bool, a zero value becomes false, and a nonzero value becomes true. A bool value may be converted to int by promotion, taking true to one and false to zero. A numeric or pointer value is converted automatically to bool when needed.
 
These keyword extensions behave as if the declaration that follows had appeared at the beginning of the file, except that assigning a nonzero integer to a bool type causes it to take on the value true.
 
   typedef enum { false, true } bool;
所以重新定义bool就是画蛇添足了,直接注释掉。
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

嵌云阁主

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值