Path: utzoo!mnetor!uunet!husc6!rutgers!iuvax!bobmon From: bobmon@iuvax.UUCP (Bobmon) Newsgroups: comp.lang.c Subject: Re: lint diagnostic Message-ID: <5304@iuvax.UUCP> Date: 27 Dec 87 16:09:25 GMT References: <365@osupyr.UUCP> Reply-To: bobmon@iuvax.UUCP (Bobmon) Organization: Indiana University, Bloomington Lines: 39 Disclaimer: I'm a rookie at this In article <365@osupyr.UUCP> gae@osupyr.UUCP (Gerald Edgar) writes: +It seems to me this is weird. Have I misunderstood something? + +112> cat x.c +#include +void defmach(lo) + int lo; +{ +printf(" %08x\n",lo); +} +main() +{ + printf("sizeof(int) = %d\n",sizeof(int)); + printf("sizeof(long) = %d\n",sizeof(long)); + defmach(65535); + exit(0); +} + +113> cc x.c +114> a.out +sizeof(int) = 4 +sizeof(long) = 4 + 0000ffff +115> lint x.c +x.c: +defmach, arg. 1 used inconsistently x.c(6) :: x.c(13) +-- After playing a bit with the Ultrix cc, and with my MSDOS TurboC, I think: 1) int's and long's are both 4 bytes on your machine (they seem to be with 'my' cc, they differ with TurboC). 2) The constant 65535 is automagically promoted to type long, which is inconsistent with the int-type parameter. (This is sensible on my TurboC, where 65535 is too big for 2 (signed) bytes; I don't know why 'cc' would bother to do it unless there's a compatibility issue here.) Did I get it right, Teacher?