Jump to content
Sign in to follow this  
Ian Smith

Accessing A Bit In An Array?

Recommended Posts

I want to do this....

 

unsigned char ar[8] = { 1,2,3,4,5,6,7,8 };

unsigned char index = 5;

unsigned char nbit = 3;

 

ar[index].nbit = 1;

 

But this gives a compile error. I also tried...

 

(*(ar+index)).nbit = 1;

 

...but with the same lack of results.

 

Is it not possible to get quick access to bits in an array? They seem to be treated differently than just a single variable.

 

--

Ian Smith

Share this post


Link to post
Share on other sites
...Is it not possible to get quick access to bits in an array?...

 

No it's not. You have to use good old bitwise operators.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

You know, I hear my colleague complain about 20 times a day about Source Boost's lack of support for bit fields, and I keep threating to tell you guys that we think the addition of bit fields is a worthy enough feature that would be worth it to us if you went to 7.0 and we had to pay for an upgrade...

 

While we are on the topic... Is there a 7.0 release planned, and what is the expected feature set?

 

Jacob

 

 

...Is it not possible to get quick access to bits in an array?...

 

No it's not. You have to use good old bitwise operators.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites
...While we are on the topic... Is there a 7.0 release planned, and what is the expected feature set?...

 

No release 7.0 is not planned yet.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...