Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site elsie.UUCP Path: utzoo!linus!gatech!seismo!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: net.lang.c Subject: Re: Uses of \"short\" ? Message-ID: <5292@elsie.UUCP> Date: Fri, 15-Nov-85 12:52:12 EST Article-I.D.: elsie.5292 Posted: Fri Nov 15 12:52:12 1985 Date-Received: Sat, 16-Nov-85 03:53:17 EST References: <3241@brl-tgr.ARPA> Organization: NIH-LEC, Bethesda, MD Lines: 22 Summary: Lest we forget. . . > . . .The main uses I have for type casts fall into a few categories: > > (void) to discard the return value of a function. . . > > Casting the returned value from malloc() (also the argument to free()). . . > > Forcing a short or an int to become a long. . .to avoid numeric overflow. > > Truncating a floating-point quantity to its integer part. . . > > Passing a NULL pointer argument to a function. > > Documenting a coercion that will occur anyhow. . . Be sure to add: Casting the first argument to fread and fwrite. -- C is a Jack Benny/Mel Blanc trademark. -- UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado@seismo.ARPA DEC, VAX and Elsie are Digital Equipment and Borden trademarks