|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
is there any defined behaviour when doing this:
__________________________ // lets assume you defined 'BYTE' // to whatever is a 8-bit-byte on your sys;-) struct x { BYTE nTreeBit : 3; BYTE nFiveBit : 5; } x.nTreeBit = 42; __________________________ my i assume nFiveBit stayes untouched? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Wed, 17 Oct 2007 07:41:08 -0700, ".rhavin grobert" <clqrq@yahoo.de>
wrote in comp.lang.c++: > is there any defined behaviour when doing this: > > __________________________ > // lets assume you defined 'BYTE' > // to whatever is a 8-bit-byte on your sys;-) > > struct x { > BYTE nTreeBit : 3; > BYTE nFiveBit : 5; > } > > x.nTreeBit = 42; > __________________________ > > > my i assume nFiveBit stayes untouched? Yes, you may. And the value in nTreeBit is implementation-defined. -- Jack Klein Home: http://JK-Technology.Com FAQs for comp.lang.c http://c-faq.com/ comp.lang.c++ http://www.parashift.com/c++-faq-lite/ alt.comp.lang.learn.c-c++ http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Oct 18, 4:30 am, Jack Klein <jackkl...@spamcop.net> wrote:
> On Wed, 17 Oct 2007 07:41:08 -0700, ".rhavin grobert" <cl...@yahoo.de> > wrote in comp.lang.c++: > > is there any defined behaviour when doing this: > > __________________________ > > // lets assume you defined 'BYTE' > > // to whatever is a 8-bit-byte on your sys;-) > > struct x { > > BYTE nTreeBit : 3; > > BYTE nFiveBit : 5; > > } > > x.nTreeBit = 42; > > __________________________ > > my i assume nFiveBit stayes untouched? > Yes, you may. And the value in nTreeBit is implementation-defined. Not if BYTE is an unsigned type. If BYTE is unsigned, nTreeBit is guaranteed to be 2. -- James Kanze (GABI Software) email:james.kanze@gmail.com Conseils en informatique orientée objet/ Beratung in objektorientierter Datenverarbeitung 9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34 |
|
![]() |
| Outils de la discussion | |
|
|