Click here to Skip to main content
12,630,940 members (31,684 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C++
in the following struct:
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
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

Rate this: bad
 
good
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.
  Permalink  

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 | Mobile
Web01 | 2.8.161205.3 | Last Updated 13 Sep 2012
Copyright © CodeProject, 1999-2016
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