[ create a new paste ] login | about

Link: http://codepad.org/Wd5uiSpk    [ raw code | output | fork ]

C++, pasted on Aug 7:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <iomanip>
#include <limits>

struct my_struct
{
  int x0 : 5;
  int x1 : 3;
  int x3;
};

int main()
{
  std::cout << std::hex;
  my_struct s = { -1, -2, std::numeric_limits<int>::max() };
  std::cout << s.x0 << '\t' << s.x1 << '\t' << s.x3 << std::endl;
}


Output:
1
1f	6	7fffffff


Create a new paste based on this one


Comments: