We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, sorry i know, this question is an evergreen. I have 320 bitfield variables, which i want to access as single Bit's on one hand, and as a field of 40 byte via RS-232 on the other hand. Yes i know this could be very critical, because every compiler could handle this on his own way. But portability is not so important for me, just want to see my little toy working :-) My hope is that someone can show me a code-example, how to declare, define and operate this. I worked with my textbook, but i'am no native english speaker, so i maybee missunderstood the point. Oh i tried so hard on this special topic, please help. Best regards
"but is my first solution for accessing these bitfield in a loop absolutly wrong?"
The one with the following as part of the union?
struct { unsigned char:1; } bit_x[320];
Then, yes. An array of 1-bit structs is not "packed".