Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!spool.mu.edu!agate!agate!dpassage From: dpassage@soda.berkeley.edu (David G. Paschich) Newsgroups: comp.unix.aux Subject: Re: More fun and games with gcc, A/UX, and porting MPW code. Message-ID: Date: 12 Jun 91 23:18:45 GMT References: <1991Jun12.083539.7444@newshost.anu.edu.au> Sender: usenet@agate.berkeley.edu (USENET Administrator) Organization: /accounts/dpassage/.organization Lines: 39 In-Reply-To: d88-jwa@byse.nada.kth.se's message of 12 Jun 91 15: 38:06 GMT In article , d88-jwa@byse.nada.kth.se (Jon W{tte) writes: > djp862@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@ocf.berkeley.edu "But I'd rather be a fish, 'cause a fish is an animal" -- Gener Fox