More fun and games with gcc, A/UX, and porting MPW code.
David G. Paschich
dpassage at soda.berkeley.edu
Thu Jun 13 09:18:45 AEST 1991
In article <D88-JWA.91Jun12173800 at byse.nada.kth.se>,
d88-jwa at byse.nada.kth.se (Jon W{tte) writes:
> djp862 at anu.oz.au ("David J Peterson") writes:
Take a look at the following if that didn't make sense, its a simple
program and the output, or errors from gcc.
void printtest(long, int, short, char, char *);
void printtest(l, i, s, c, cp)
long l;
int i;
short s;
char c;
char *cp;
{
The right and correct way is to change the definition to:
void
printtest ( long l , int i , short s , char c , char * cp )
{
... the reason being that the function prototype is ansi-style, so the
compiler assumes that the arguments will actually be of the indicated
size. Then your function definition uses an old-style function
definition, in which the compiler assumes that anything smaller than
an int will promote to an int.
The solution: If you're going to use ansi-style prototypes, then use
ansi-style definitions.
--
David G. Paschich Open Computing Facility UC Berkeley
dpassage at ocf.berkeley.edu
"But I'd rather be a fish, 'cause a fish is an animal" -- Gener Fox
More information about the Comp.unix.aux
mailing list