uint8_t有VS无符号字符 [英] uint8_t vs unsigned char
本文介绍了uint8_t有VS无符号字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是使用的好处 uint8_t有
在用C unsigned char型
?
What is the advantage of using uint8_t
over unsigned char
in C?
我知道,几乎每一个系统 uint8_t有
仅仅是 unsigned char型
的typedef,
那么为什么使用它呢?
I know that on almost every system uint8_t
is just a typedef for unsigned char
,
so why use it?
推荐答案
它记录你的意图 - 要存储小的数字,而不是一个字符
It documents your intent - you will be storing small numbers, rather than a character.
此外,它看起来更好,如果你使用其他类型定义,如 uint16_t
或 int32_t
。
Also it looks nicer if you're using other typedefs such as uint16_t
or int32_t
.
这篇关于uint8_t有VS无符号字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文