Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Test bitfields with unnamed union
//clang 3.7.0 #include <iostream> typedef struct bitfield { unsigned int a:16; unsigned int b:17; union u { unsigned int c:4; unsigned int d:32; }U; }bfield; typedef struct bitfield2 { unsigned int a:16; unsigned int b:17; union { unsigned int c:4; unsigned int d:32; }; }bfield2; int main() { std::cout << "Test bitfields1\n" << sizeof(bfield) << "\n"; std::cout << "Test bitfields2\n" << sizeof(bfield2) << "\n"; static volatile bfield y; y.a=0x1234; y.b = 0x1FF55; y.U.d = 0x5a5a5a5a; std::cout << std::hex << y.U.d << "\n"; static volatile bfield2 x; x.a=0x1234; x.b = 0x1FF55; x.d = 0x5a5a5a5a; std::cout << std::hex << x.d << "\n"; }
run
|
edit
|
history
|
help
0
Throttle Example using a circular queue (Push all but 2 less than maxSize; then pop all but 2 of current size)
constructor-is-not-called-in-this-aggregation-class
return reference (clang)
FUCK
Recursive Enumeration Example
marquee text in C++
Maze problem solution
cv5_class
MPL 2-1
ghfhfgh