Click here to Skip to main content
13,297,321 members (66,088 online)
Rate this:
Please Sign up or sign in to vote.
See more:
in the following struct:
    bool simultaneousAction:1;
    bool action[7]:1;

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
Posted 13-Sep-12 3:51am
pasztorpisti 13-Sep-12 8:55am
A C++ array can not be packed. Period.
Richard MacCutchan 13-Sep-12 9:20am
Because you cannot directly address single bits, an array of bits is not a valid construct.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171207.1 | Last Updated 13 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100