Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.1
 
1.2
 
MAIN:plunky:20111107094700
 
init003.c
_>11 /*
<>2 - * pcc-bug
  2+ * pcc-bug
33  * Subject:    packed structures
 44  * From:       Gregory McGarry <greg () bitlynx ! com>
 55  *
<>6 - * While fields appear to be packed, the overall size of the structure 
  6+ * While fields appear to be packed, the overall size of the structure
77  * isn't.
 88  *
<>9 - * TODO:
 10 - * size of struct: gcc says 8, pcc says 5 
 11 - * I believe gcc... 
  9+ * TODO:
  10+ * handle different alignment requirements
1211  */
 1312 
<>14 -//#include <stdio.h>
  13+#if defined(__PCC__)
  14+#define __packed        _Pragma("packed")
  15+#elif defined(__GNUC__)
  16+#define __packed        __attribute__ ((__packed__))
  17+#else
  18+#define __packed        /* nothing */
  19+#endif
1520 
<>16 -#define __packed _Pragma("packed")
 17 -//#define __packed __attribute__ ((__packed__))
 18 -//#define __packed /* nothing */
  21+struct st0 {
  22+        char c;
  23+        int i;
  24+};
1925 
<>20 -struct st {
 21 -         char c;
 22 -         int i;
 23 -} __packed t;
  26+struct st1 {
  27+        char c;
  28+        int i;
  29+} __packed;
2430 
 2531 int
 2632 main(void)
 2733 {
<>28 -        if (sizeof(struct st) != 8 )
 29 -                return 1;
  34+        if (sizeof(struct st0) != sizeof(int) + sizeof(int))
  35+                return 1;
3036 
<>31 -        return 0 ;
  37+        if (sizeof(struct st1) != sizeof(int) + sizeof(char))
  38+                return 1;
  39+
  40+        return 0;
<_3241 }
 3342 
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-08-30 06:14 +0200