Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Unsigned considerations Message-ID: <1988Feb7.000253.465@utzoo.uucp> Organization: U of Toronto Zoology References: <3373@bobkat.UUCP> Date: Sun, 7-Feb-88 00:02:50 EST > int i; > unsigned long ul; > > ul = i; > > How does the ANSI thing say this conversion should be done? X3J11 (November draft) says ul = (unsigned long)(long)i; is how it happens. This makes a certain amount of sense: adjusting the size before adjusting the signedness produces results that I would say are (a) less surprising, and (b) more portable across variations in relative sizes of data types. -- Those who do not understand Unix are | Henry Spencer @ U of Toronto Zoology condemned to reinvent it, poorly. | {allegra,ihnp4,decvax,utai}!utzoo!henry