Mercurial > projects > dstress
comparison run/mini/packed1.d @ 1628:c6ef09dfba4d
add mini test set from ldc project
author | Moritz Warning <moritzwarning@web.de> |
---|---|
date | Mon, 10 Jan 2011 19:47:18 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1627:e1b954780837 | 1628:c6ef09dfba4d |
---|---|
1 module mini.packed1; | |
2 | |
3 extern(C) int printf(char*, ...); | |
4 | |
5 align(1) | |
6 struct PackedStruct | |
7 { | |
8 ubyte ub; | |
9 float f; | |
10 long l; | |
11 short s; | |
12 ubyte ub2; | |
13 short s2; | |
14 } | |
15 | |
16 void main() | |
17 { | |
18 PackedStruct[2] a = void; | |
19 void* begin = a.ptr; | |
20 void* end = &a[1]; | |
21 ptrdiff_t sz = end - begin; | |
22 printf("size = 18 = %u = %u\n", PackedStruct.sizeof, sz); | |
23 assert(sz == 18); | |
24 } |