fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct structure __attribute__ (packed) {
  5. char a;
  6. int b;
  7. char c;
  8. };
  9.  
  10. int main() {
  11.  
  12. std::cout << sizeof(struct structure) << '\n';
  13.  
  14. return 0;
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:4:33: error: expected ‘(’ before ‘packed’
 struct structure __attribute__ (packed) {
                                 ^
prog.cpp:4:41: error: expected ‘)’ before ‘{’ token
 struct structure __attribute__ (packed) {
                                         ^
prog.cpp:4:8: warning: attribute ignored in declaration of ‘struct structure’ [-Wattributes]
 struct structure __attribute__ (packed) {
        ^
prog.cpp:4:8: note: attribute for ‘struct structure’ must follow the ‘struct’ keyword
prog.cpp: In function ‘int main()’:
prog.cpp:12:38: error: invalid application of ‘sizeof’ to incomplete type ‘structure’
  std::cout << sizeof(struct structure) << '\n';
                                      ^
stdout
Standard output is empty