Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/3/84; site mtsbb.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!mhuxm!mhuxf!mhuxi!mhuhk!mhuxt!houxm!mtuxo!mtsbb!lav From: lav@mtsbb.UUCP (L.A.VALLONE) Newsgroups: net.unix,net.micro.att,net.lang.c Subject: query: argument passing on UNIX PC, VAX, et al Message-ID: <168@mtsbb.UUCP> Date: Thu, 15-May-86 20:12:38 EDT Article-I.D.: mtsbb.168 Posted: Thu May 15 20:12:38 1986 Date-Received: Sat, 17-May-86 04:07:21 EDT Distribution: na Organization: AT&T-Information Systems, Middletown, NJ Lines: 41 Xref: watmath net.unix:7875 net.micro.att:1188 net.lang.c:9042 I am interested in the precision used by various C compilers when passing arguments on the stack to a called routine. For example: some_routine_or_main() { char a,b; foo(a,b) } foo (a,b) long a,b; { printf("%#lx\t%#lx\n", a, b); } I tried a program similar to the above on a vax and a UNIX PC and in both cases the values of 'a' and 'b' were correctly passed. Given that a long on both machines is 32 bits and a char is 8 bits, from this I assumed that both compilers are expanding 'a' and 'b' to 32 bits before putting them on the stack. I might have expected this for the vax, but not for the UNIX PC (68000 based). I also tried seperating the functions among 2 files to eliminate the possibility of the compiler detecting the inconsistency and correcting (though this doesn't mean the loader isn't being smart). Again, it worked. Does anyone know if my assumption is correct? Is my model not telling me what I think it is? Are there any C compilers that don't behave this way? Please respond by Email and I'll post if anyone else is interested. Thanks in advance -- Lee Vallone AT&T Information Systems Merlin {... ihnp4, mtuxo}!mtsbb!lav