blob: bf745eefaada32e7615905cc15803154e584b855 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/*
* Copyright (C) 2015 Tomasz Kramkowski <tk@the-tk.com>
*
* This program is free software. It is licensed under version 3 of the
* GNU General Public License.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see [http://www.gnu.org/licenses/].
*/
#include <stdio.h>
#include <stdlib.h>
struct misaligned {
char ca;
long la;
char cb;
long lb;
char cc;
long lc;
char cd;
long ld;
char ce;
long le;
char cf;
long lf;
char cg;
long lg;
char ch;
long lh;
};
struct aligned {
char ca;
char cb;
char cc;
char cd;
char ce;
char cf;
char cg;
char ch;
long la;
long lb;
long lc;
long ld;
long le;
long lf;
long lg;
long lh;
};
int main(void)
{
printf("sizeof misaligned: %d, sizeof aligned %d\n", sizeof(struct
misaligned), sizeof(struct aligned));
return EXIT_SUCCESS;
}
|