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#pragma ident "%Z%%M% %I% %E% SMI" 28178476Sjb 29178476Sjb/* 30178476Sjb * ASSERTION: 31178476Sjb * positive type conversion checks 32178476Sjb * 33178476Sjb * SECTION: Types, Operators, and Expressions/Type Conversions 34178476Sjb * 35178476Sjb * NOTES: not all type conversions are checked. A lot of this section 36178476Sjb * is tested within other tests. 37178476Sjb */ 38178476Sjb 39178476Sjb#pragma D option quiet 40178476Sjb 41178476Sjbunsigned int i; 42178476Sjbchar c; 43178476Sjbshort s; 44178476Sjblong l; 45178476Sjblong long ll; 46178476Sjb 47178476SjbBEGIN 48178476Sjb{ 49178476Sjb/* char -> int */ 50178476Sjb c = 'A'; 51178476Sjb i = c; 52178476Sjb printf("c is %c i is %d\n", c, i); 53178476Sjb 54178476Sjb/* int -> char */ 55178476Sjb 56178476Sjb i = 1601; 57178476Sjb c = i; 58178476Sjb printf("i is %d c is %c\n", i, c); 59178476Sjb 60178476Sjb/* char -> short */ 61178476Sjb c = 'A'; 62178476Sjb s = c; 63178476Sjb printf("c is %c s is %d\n", c, s); 64178476Sjb 65178476Sjb/* short -> char */ 66178476Sjb 67178476Sjb s = 1601; 68178476Sjb c = s; 69178476Sjb printf("s is %d c is %c\n", s, c); 70178476Sjb 71178476Sjb/* int -> short */ 72178476Sjb 73178476Sjb i = 1601; 74178476Sjb s = i; 75178476Sjb printf("i is %d s is %d\n", i, s); 76178476Sjb 77178476Sjb/* short -> int */ 78178476Sjb 79178476Sjb s = 1601; 80178476Sjb i = s; 81178476Sjb printf("s is %d i is %d\n", s, i); 82178476Sjb 83178476Sjb/* int -> long long */ 84178476Sjb 85178476Sjb i = 4294967295; 86178476Sjb ll = i; 87178476Sjb printf("i is %d ll is %x\n", i, ll); 88178476Sjb 89178476Sjb/* long long -> int */ 90178476Sjb 91178476Sjb ll = 8589934591; 92178476Sjb i = ll; 93178476Sjb printf("ll is %d i is %x\n", ll, i); 94178476Sjb 95178476Sjb/* char -> long long */ 96178476Sjb 97178476Sjb c = 'A'; 98178476Sjb ll = c; 99178476Sjb printf("c is %c ll is %x\n", c, ll); 100178476Sjb 101178476Sjb/* long long -> char */ 102178476Sjb 103178476Sjb ll = 8589934401; 104178476Sjb c = ll; 105178476Sjb printf("ll is %x c is %c\n", ll, c); 106178476Sjb 107178476Sjb exit(0); 108178476Sjb} 109178476Sjb 110