Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!munnari.oz.au!manuel!djp862 From: djp862@anu.oz.au ("David J Peterson") Newsgroups: comp.unix.aux Subject: More fun and games with gcc, A/UX, and porting MPW code. Message-ID: <1991Jun12.083539.7444@newshost.anu.edu.au> Date: 12 Jun 91 08:35:39 GMT Article-I.D.: newshost.1991Jun12.083539.7444 Sender: news@newshost.anu.edu.au Organization: Australian National University, Canberra, Australia. Lines: 75 Hello all, Thanks to all who repsonded on the variable argument problem, I got that sorted out. Now here's a new one for you. Is there some reason why I can only pass 4 byte quantities between function using gcc (v1.39) when I use function prototypes, but can pass anything I want when I don't use prototypes? Take a look at the following if that didn't make sense, its a simple program and the output, or errors from gcc. -------------------------- #include #ifdef PROTO void printtest(long, int, short, char, char *); #else void printtest(); #endif void main() { long l = 4000000000; int i = 4000000000; short s = 65000; char c = 'C'; char *cp = "StringPtr"; printtest(l, i, s, c, cp); } void printtest(l, i, s, c, cp) long l; int i; short s; char c; char *cp; { printf("long\t%d\tsize: %d\n", l, sizeof(l)); printf("int\t%d\tsize: %d\n", i, sizeof(i)); printf("short\t%d\t\tsize: %d\n", s, sizeof(s)); printf("char\t%c\t\tsize: %d\n", c, sizeof(c)); printf("char *\t%s\tsize: %d\n", cp, sizeof(cp)); } ------------------ and then: ------------------ % gcc -o test test.c % ./test long -294967296 size: 4 int -294967296 size: 4 short -536 size: 2 char C size: 1 char * StringPtr size: 4 % gcc -DPROTO -o test test.c test.c test.c: In function printtest: test.c:26: argument `s' doesn't match function prototype test.c:26: a formal parameter type that promotes to `int' test.c:26: can match only `int' in the prototype test.c:26: argument `c' doesn't match function prototype test.c:26: a formal parameter type that promotes to `int' test.c:26: can match only `int' in the prototype % ------------------ Whats the deal here? The '-traditional' and/or '-ansi' flags in gcc don't make any difference. And the native cc doesn't deal with prototypes at all. -dave.