|
|
|
0 | 1 | 0xa7 |
1 | 1 | 0xf1 |
2 | 1 | 0xd9 |
3 | 1 | 0x2a |
4 | 0 | 0x82 |
5 | 1 | 0xc8 |
6 | 1 | 0xd8 |
7 | 1 | 0xfe |
8 | 1 | 0x43 |
9 | 0 | 0x4d |
10 | 1 | 0x98 |
11 | 1 | 0x55 |
12 | 0 | 0x8c |
13 | 1 | 0xe2 |
14 | 1 | 0xb3 |
15 | 1 | 0x47 |
0x47f4 _____________ 0x4d9a _____________ 0x1a45 _____________ 0xa702 _____________ 0x1a42 _____________ 0x1b40 _____________ 0x1a45 _____________
int foo (int a, int b, int c) { int t = a + b; int t2 = c - t; return t2; }When compiled into x86_64, it looks like this:
foo: movl %edx, %eax addl %esi, %edi subl %edi, %eax ret
struct { int a; char b; double c; char *d; char e; } X; int main () { printf ("%d\n", sizeof (X)); printf ("%p\n", & X); X.a = 1; X.b = 2; X.c = 3; X.d = (char *) & X; X.e = 4; printf ("%d\n", * X.d); printf ("%d\n", * (X.d + 4)); printf ("%d\n", * (X.d + 24)); return 0; }The first printf prints 32. The second printf prints 0x601080 (note that %p prints a hexadecimal pointer value).