Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in the following struct:
C#
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
Comments
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

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.
 
Share this answer
 

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


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900