Declaring a bit field in a C ++ structure

I read the ISO C ++ standard and I came to these bit field declarations. The following code is not entirely clear to me

struct {
 char a;
 int b:5,
 c:11,
 :0,
 d:8;
 struct {int ee:8;}
 e;
 } 

Here it is indicated that the fields a, d and e.ee have different memory cells, and they can be changed independently using several threads. Bit fields b and c use the same memory cells, so they cannot be changed at the same time. I do not understand the importance of using two-bit fields for ie The c, c:11,:0,. can anyone clear my vision of this? thank

+4
source share
2 answers

You asked:

c i.e, c: 11,: 0,. - ?

c . - . - . , .

, , . - . [: , . - ] . - .

+5

the: 0, , c d .

, . , 32 , , b c 24 32 , : 0 d . , , , .

, a, b c , d , , , , e.

+2

Source: https://habr.com/ru/post/1568430/


All Articles