mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
Added more thorough structure handling tests and removed some old ones.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16418 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
edfa212583
commit
393a8d266d
7 changed files with 74 additions and 572 deletions
|
@ -37,6 +37,25 @@ int main ()
|
|||
id x;
|
||||
NSString *s;
|
||||
NSArray *a = [NSArray arrayWithObjects: @"a", @"b", nil];
|
||||
struct aa {char a; double b; char c;} bb[2];
|
||||
struct objc_struct_layout layout;
|
||||
unsigned i;
|
||||
|
||||
printf("size = %d\n", objc_sizeof_type(@encode(struct aa)));
|
||||
printf("pos = %d\n", (void*)&bb[1] - (void*)&bb[0]);
|
||||
|
||||
objc_layout_structure (@encode(struct aa), &layout);
|
||||
while (objc_layout_structure_next_member (&layout))
|
||||
{
|
||||
int position, align;
|
||||
const char *type;
|
||||
|
||||
objc_layout_structure_get_info (&layout, &position, &align, &type);
|
||||
printf ("element %d has offset %d, alignment %d\n",
|
||||
i++, position, align);
|
||||
}
|
||||
|
||||
|
||||
|
||||
o = [GCMutableArray new];
|
||||
x = [GCMutableArray new];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue