开发者

Is this code declaring a type?

开发者 https://www.devze.com 2023-03-30 08:33 出处:网络
#ifdef _CPU_8BIT_INT_ // unsigned 8 bit typedef unsign开发者_运维问答ed _CPU_8BIT_INT_ u8 ; What is the code above doing? Is it trying to declare a type? (type as in integer, char etc.)Yes, typedef
#ifdef _CPU_8BIT_INT_
// unsigned 8 bit
typedef unsign开发者_运维问答ed _CPU_8BIT_INT_ u8 ;

What is the code above doing? Is it trying to declare a type? (type as in integer, char etc.)


Yes, typedef is used to declare a type. From now on

u8 x;
/* Equivalent to. */
unsigned _CPU_8BIT_INT_ x;

Are you sure you're not better off using uint8_t from stdint.h ?

0

精彩评论

暂无评论...
验证码 换一张
取 消