1178476Sjb/* 2178476Sjb * CDDL HEADER START 3178476Sjb * 4178476Sjb * The contents of this file are subject to the terms of the 5178476Sjb * Common Development and Distribution License (the "License"). 6178476Sjb * You may not use this file except in compliance with the License. 7178476Sjb * 8178476Sjb * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9178476Sjb * or http://www.opensolaris.org/os/licensing. 10178476Sjb * See the License for the specific language governing permissions 11178476Sjb * and limitations under the License. 12178476Sjb * 13178476Sjb * When distributing Covered Code, include this CDDL HEADER in each 14178476Sjb * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15178476Sjb * If applicable, add the following below this CDDL HEADER, with the 16178476Sjb * fields enclosed by brackets "[]" replaced with your own identifying 17178476Sjb * information: Portions Copyright [yyyy] [name of copyright owner] 18178476Sjb * 19178476Sjb * CDDL HEADER END 20178476Sjb */ 21178476Sjb 22178476Sjb/* 23178476Sjb * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24178476Sjb * Use is subject to license terms. 25178476Sjb */ 26178476Sjb 27178476Sjb/* 28178476Sjb * ASSERTION: 29178476Sjb * 30178476Sjb * Test different inline assignments by various expressions. 31178476Sjb * 32178476Sjb * SECTION: Type and Constant Definitions/Inlines 33178476Sjb * 34178476Sjb * NOTES: The commented lines for the floats and doubles should be uncommented 35178476Sjb * once the functionality is implemented. 36178476Sjb * 37178476Sjb */ 38178476Sjb 39178476Sjb#pragma ident "%Z%%M% %I% %E% SMI" 40178476Sjb 41178476Sjb#pragma D option quiet 42178476Sjb 43178476Sjb 44178476Sjbinline char new_char = 'c' + 2; 45178476Sjbinline short new_short = 10 * new_char; 46178476Sjbinline int new_int = 100 + new_short; 47178476Sjbinline long new_long = 1234567890; 48178476Sjbinline long long new_long_long = 1234512345 * new_long; 49178476Sjbinline int8_t new_int8 = 'p'; 50178476Sjbinline int16_t new_int16 = 20 / new_int8; 51178476Sjbinline int32_t new_int32 = 200; 52178476Sjbinline int64_t new_int64 = 2000000 * (-new_int16); 53178476Sjbinline intptr_t new_intptr = 0x12345 - 129; 54178476Sjbinline uint8_t new_uint8 = 'q'; 55178476Sjbinline uint16_t new_uint16 = 30 - new_uint8; 56178476Sjbinline uint32_t new_uint32 = 300 - 0; 57178476Sjbinline uint64_t new_uint64 = 3000000; 58178476Sjbinline uintptr_t new_uintptr = 0x67890 / new_uint64; 59178476Sjb 60178476Sjb/* inline float new_float = 1.23456; 61178476Sjbinline double new_double = 2.34567890; 62178476Sjbinline long double new_long_double = 3.567890123; 63178476Sjb*/ 64178476Sjb 65178476Sjbinline int * pointer = &`kmem_flags; 66178476Sjbinline int result = 3 > 2 ? 3 : 2; 67178476Sjb 68178476SjbBEGIN 69178476Sjb{ 70178476Sjb printf("new_char: %c\nnew_short: %d\nnew_int: %d\nnew_long: %d\n", 71178476Sjb new_char, new_short, new_int, new_long); 72178476Sjb printf("new_long_long: %d\nnew_int8: %d\nnew_int16: %d\n", 73178476Sjb new_long_long, new_int8, new_int16); 74178476Sjb printf("new_int32: %d\nnew_int64: %d\n", new_int32, new_int64); 75178476Sjb printf("new_intptr: %d\nnew_uint8: %d\nnew_uint16: %d\n", 76178476Sjb new_intptr, new_uint8, new_uint16); 77178476Sjb printf("new_uint32:%d\nnew_uint64: %d\nnew_uintptr:%d\nresult:%d", 78178476Sjb new_uint32, new_uint64, new_uintptr, result); 79178476Sjb exit(0); 80178476Sjb} 81