910623-为什么位字段不能具有间接寻址? [英] 910623 - why bit fields cannot have indirection?

查看:122
本文介绍了910623-为什么位字段不能具有间接寻址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在以下结构中:

in the following struct:

struct
{
    bool simultaneousAction:1;
    bool action[7]:1;
};


我想知道为什么必须生成C2033?从逻辑上讲,它一定不是错误的.必须有一个字节的开头,该字节的第一个(LSb)被称为relativeAction,下一个字节被称为action [0],最后一个字节(MSb)被称为action [6].
这种情况有什么问题,为什么会出现以下错误?


i wonder why C2033 must be generated?! logically it must not be erroneous. there must be a byte first of which (LSb) be called simultaneousAction, the next bit be called action[0] and the last one (MSb) be called action[6].
what''s the problem with this scenario and why do i get the following error?

error C2033: ''AsServoMotorProperties::<unnamed-tag>::action'' : bit field cannot have indirection

推荐答案

位字段的基础类型必须是整数类型.数组类似于指针,因此不是整数类型.
The underlying type of a bit field must be an integral type. An array is similar to a pointer and therefore not an integral type.


这篇关于910623-为什么位字段不能具有间接寻址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆