Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site watdaisy.UUCP Path: utzoo!watmath!watdaisy!ndiamond From: ndiamond@watdaisy.UUCP (Norman Diamond) Newsgroups: net.lang.c Subject: Re: conversion of short to unsigned it Message-ID: <7149@watdaisy.UUCP> Date: Tue, 26-Mar-85 22:41:08 EST Article-I.D.: watdaisy.7149 Posted: Tue Mar 26 22:41:08 1985 Date-Received: Wed, 27-Mar-85 05:11:29 EST References: <2125@ncrcae.UUCP> <7088@watdaisy.UUCP> <2128@ncrcae.UUCP> <706@turtlevax.UUCP> Organization: U of Waterloo, Ontario Lines: 30 > The "(unsigned int)" is a cast, saying that s is to be > considered unsigned rather than signed. It is NOT a conversion. The > fact that s was declared to be a "short int" is immaterial; it is of > type int rather than float, etc. This has the same effect as saying > "(unsigned)", without the "int". Int has no inherent size associated > with it; the size of an int is machine-dependent. If you want an int > of a specific size, you say "short int" or "long int". > -- Ken Turkowski @ CADLINC, Menlo Park, CA A cast had better do conversion. Can you imagine (float) 3 being some epsilon-ish sort of value? Can you imagine char *c; int *x; x = (int *) c; not converting from (char *) to (int *) ? (This is irrelevant on machines that use char * for all pointers. If a machine uses byte offsets for char * ... such as calloc still is supposed to return ... and the assignment doesn't CONVERT the result of calloc to int * ... then we might as well give up with C.) -- Norman Diamond UUCP: {decvax|utzoo|ihnp4|allegra}!watmath!watdaisy!ndiamond CSNET: ndiamond%watdaisy@waterloo.csnet ARPA: ndiamond%watdaisy%waterloo.csnet@csnet-relay.arpa "Opinions are those of the keyboard, and do not reflect on me or higher-ups."