Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83 SMI; site sun.uucp
Path: utzoo!watmath!clyde!floyd!harpo!decvax!decwrl!sun!gnu
From: gnu@sun.uucp (John Gilmore)
Newsgroups: net.lang.c
Subject: Re: Mixing char and int types as parameters in portable (summary).
Message-ID: <664@sun.uucp>
Date: Wed, 21-Mar-84 04:47:29 EST
Article-I.D.: sun.664
Posted: Wed Mar 21 04:47:29 1984
Date-Received: Thu, 22-Mar-84 01:28:38 EST
References: <5743@mcvax.UUCP> <2753@brl-vgr.ARPA>
Organization: Sun Microsystems, Inc.
Lines: 15

> Therefore it makes little sense to declare the formal parameters of a
> function to be type char or float, since actual arguments never will be.

I disagree.  For example, a char or short can be multiplied much
faster on a 68000 than a (32-bit) int or long.  Also, if the parameter
is declared to be a char, one-byte compares can be done on it, rather
than 4-byte compares.  Since the "conversion" from an int to a char or
short costs nothing, but gains something, you might as well just say
what you mean and call it a char.

This is NOT true for IEEE float, since the float format and the
double format have different bit configurations (more exponent bits
in the doubles).  Conversion to float will cost, but then computation
can be cheaper, so it's a tradeoff.  (Our C compiler has a switch to
generate float expressions in float rather than double, to save time.)