此帖出自stm32/stm8论坛
最新回复
我来说说我的观点吧,其实我不太同意你7楼的看法,观点过于激进。
1. 你也承认了,除了unsigned int和signed int之外,可以使用其他的数据类型。
2. 考虑到可移植性的时候,位域特性尽量就别使用了,位域的可移植性涉及到处理器的位宽和字节序。在嵌入式领域位域通常用来对特殊功能寄存器进行声明,这种一般都没有移植的价值,就像你举的例子一样,同样没有可移植性,因为uint32_t与unsigned int并不等价,仅在你的编译器环境下才等价,在8位16位环境下就需要使用unsigned long类型来对应,因此uint32_t的使用也并不符合你的要求。可移植性的话题太大,就像int由于位宽问题也会导致移植问题,但是大多数人也还是在用。
如果确实要考虑广义的可移植性,那我建议就别使用位域功能了,直接使用位操作来代替。
详情
回复
发表于 2016-7-13 12:39
| ||
|
||
此帖出自stm32/stm8论坛
点评 | ||
个人签名人生有许多选项是灰色的、不可选的,但至少你可以选择生活的态度。。。韬光养晦,志存高远http://www.xzroad.com/
|
||
| |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
此帖出自stm32/stm8论坛
点评 | ||
|
||
此帖出自stm32/stm8论坛
| ||
|
||
此帖出自stm32/stm8论坛
| ||
|
||
此帖出自stm32/stm8论坛
| ||
|
||
此帖出自stm32/stm8论坛
点评 | ||
|
||
此帖出自stm32/stm8论坛
点评 | ||
|
||
此帖出自stm32/stm8论坛
点评 | ||
|
||
此帖出自stm32/stm8论坛
| ||
|
||
此帖出自stm32/stm8论坛
| ||
个人签名刻苦学习,共同进步
|
||
此帖出自stm32/stm8论坛
| ||
|
||
此帖出自stm32/stm8论坛
| ||
|
||
此帖出自stm32/stm8论坛
| ||
|
||
此帖出自stm32/stm8论坛
| ||
|
||
浏览过的版块 |
EEWorld Datasheet 技术支持