fork download
  1. #include <iostream>
  2. using namespace std;
  3. #include <stdint.h>
  4. #include <stdio.h>
  5.  
  6. typedef struct structTag {
  7. union {
  8. struct {
  9. uint32_t messageID : 26; /* 26bit message id, 67108864 ids */
  10. uint8_t priority : 3; /* priority: MUST BE 0 */
  11. } __attribute__ ((packed));
  12. struct {
  13. uint32_t rawID : 29;
  14. uint8_t canFlags : 3;
  15. };
  16. } __attribute__ ((packed));
  17. } __attribute__ ((packed)) idSpecial;
  18.  
  19. int main() {
  20. printf("size: %d", sizeof(idSpecial));
  21. return 0;
  22. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
size: 4