[Qt-interest] Question about bitfields
Thiago Macieira
thiago at kde.org
Sat Jul 17 09:47:22 CEST 2010
On Friday 16. July 2010 10.23.03 Dan White wrote:
> Thanks, but I can see I did not include enough info in my original
> question.
>
> I need to, for example, manipulate two boolean bits and a 14-bit signed
> integer stored in 2 bytes.
>
> In plain old vanilla C, you say :
>
> struct foo
> {
> unsigned flag1:1 ;
> unsigned flag2:1;
> signed number:14
> } ;
You're saying that you're looking for something more from Qt. From my point of
view, the above looks perfect already for what you're trying to do.
So what more are you looking for?
Also note that in C++ you can declare other integer types in bitfields, like
short, long, long long, enums, etc.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100717/4fb25e66/attachment.bin
More information about the Qt-interest-old
mailing list