Bit Order in Bit Fields

Discussion in 'C++' started by Mike -- Email Ignored, May 2, 2009.

  1. In bit fields, am I guaranteed that the order
    of the bits used is from low to high?

    For example, in the fragment below, am I
    guaranteed that the symbol "hi" refers to
    the high order bit in an element of
    type TYP (as it does on my box)?

    template <class TYP>
    struct Sfield
    {
    TYP lo : sizeof(TYP) * 8 - 1;
    TYP hi : 1;
    };

    Thanks,
    Mike.
    Mike -- Email Ignored, May 2, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    1,752
    Timothy Bendfelt
    Jan 19, 2007
  2. Martin Vorbrodt

    order of bit fields

    Martin Vorbrodt, Nov 1, 2005, in forum: C++
    Replies:
    6
    Views:
    1,414
  3. Replies:
    9
    Views:
    970
    Juha Nieminen
    Aug 22, 2007
  4. call_me_anything
    Replies:
    4
    Views:
    462
    Pete Becker
    Sep 30, 2007
  5. Jeff.M
    Replies:
    6
    Views:
    172
    Lasse Reichstein Nielsen
    May 4, 2009
Loading...

Share This Page