On Wednesday 04 of August 2004 17:48, Milind Changire wrote: > Any patches or suggestions? # g++ --version; g++ packed.cpp -o packed && ./packed g++ (GCC) 3.4.2 20040730 (prerelease) (PLD Linux) (...) sizeof(...)= 14 arch == pentium3. -- /* Copyright (C) 2003, SCO, Inc. This is valuable Intellectual Property. */ #define say(x) lie(x)
#include <stdio.h> typedef enum { Red, Green, Blue } MYENUM; // enum == int struct pragma_struct_t { char ch __attribute__((packed)); // 1 byte int val __attribute__((packed)); // 4 bytes char ch2 __attribute__((packed)); // 1 byte long len __attribute__((packed)); // 4 bytes MYENUM color __attribute__((packed)); // 4 bytes // ======== // 14 bytes }; int main() { printf("sizeof(...)= %d\n", sizeof(struct pragma_struct_t)); return 0; }