Quick Search:

View

Revision:
Expand:  
Changeset: MAIN:plunky:20111107094700

Diff

Diff from 1.2 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/pcc/pcc-tests/regress/pcclist/init003.c

Annotated File View

faceless
1.1
1 /*
plunky
1.2
2  * pcc-bug
faceless
1.1
3  * Subject:    packed structures
4  * From:       Gregory McGarry <greg () bitlynx ! com>
5  *
plunky
1.2
6  * While fields appear to be packed, the overall size of the structure
faceless
1.1
7  * isn't.
8  *
plunky
1.2
9  * TODO:
10  * handle different alignment requirements
faceless
1.1
11  */
12
plunky
1.2
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
20
21 struct st0 {
22         char c;
23         int i;
24 };
25
26 struct st1 {
27         char c;
28         int i;
29 __packed;
faceless
1.1
30
31 int
32 main(void)
33 {
plunky
1.2
34         if (sizeof(struct st0) != sizeof(int) + sizeof(int))
35                 return 1;
36
37         if (sizeof(struct st1) != sizeof(int) + sizeof(char))
38                 return 1;
faceless
1.1
39
plunky
1.2
40         return 0;
faceless
1.1
41 }
42
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-21 22:01 +0200