sizeof bit-fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I tried to declare a bit-filed in this way:

struct rec
{
	unsigned short a : 10;
	unsigned short b : 10;
	unsigned short c : 10;
	unsigned short d : 10;
};

40 bits = 5 byte.
but sizeof(struct rec) is 8.

How can I obtain a 5 bytes long structure (if it is possible)? 

thanks
-- 
Massimiliano Cialdi
cialdi@xxxxxxxxxxx
m.cialdi@xxxxxxxx


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux