/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ASSERTION: Declare arrays of different data types and verify that the
* addresses of the individual elements differ by an amount equal to the number
* elements separating them multiplied by the size of each element.
*
*
* NOTES:
*
*/
char char_array[5];
short short_array[5];
int int_array[5];
long long_array[5];
long long long_long_array[5];
/*
float float_array[5];
double double_array[5];
long double long_double_array[5];
string string_array[5];
*/
struct record {
char ch;
int in;
} struct_array[5];
struct {
char ch;
int in;
} anon_struct_array[5];
union record {
char ch;
int in;
} union_array[5];
union {
char ch;
int in;
} anon_union_array[5];
enum colors {
RED,
} enum_array[5];
{
long_long_var0 = &long_long_array[0];
anon_union_var0 = &anon_union_array[0];
printf("char_var2 - char_var0: %d\n",
printf("short_var3 - short_var0: %d\n",
(int) short_var3 - (int) short_var0);
printf("long_var4 - long_var0: %d\n",
printf("long_long_var2 - long_long_var0: %d\n",
(int) long_long_var2 - (int) long_long_var0);
printf("int8_var5 - int8_var3: %d\n",
printf("int16_var4 - int16_var0: %d\n",
(int) int16_var4 - (int) int16_var0);
printf("int32_var3 - int32_var0: %d\n",
(int) int32_var3 - (int) int32_var0);
printf("int64_var1 - int64_var0: %d\n",
(int) int64_var1 - (int) int64_var0);
printf("uintptr_var2 - uintptr_var0: %d\n",
(int) uintptr_var2 - (int) uintptr_var0);
printf("struct_var2 - struct_var0: %d\n",
(int) struct_var2 - (int) struct_var0);
printf("anon_struct_var5 - anon_struct_var3: %d\n",
(int) anon_struct_var5 - (int) anon_struct_var3);
printf("union_var3 - union_var0: %d\n",
(int) union_var3 - (int) union_var0);
printf("anon_union_var4 - anon_union_var0: %d\n",
(int) anon_union_var4 - (int) anon_union_var0);
printf("enum_var2 - enum_var0: %d\n",
exit(0);
}
{
exit(1);
}