奇怪的结构定义?

Alc*_*ott 0 c struct

可能重复:
'unsigned temp:3'表示什么

A struct的定义是这样的,

typedef struct
{   
    uint32_t length : 8;  
    uint32_t offset : 24;
    uint32_t type : 8;
} A;
Run Code Online (Sandbox Code Playgroud)

我还没有看到这种定义之前,这是什么意思:8:24

Som*_*ude 6

它定义了位域.这告诉编译器length8位,offset是24位,type也是8位.