Xref: utzoo comp.lang.c:6252 comp.sys.m68k:654 Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!apollo!johnf From: johnf@apollo.uucp (John Francis) Newsgroups: comp.lang.c,comp.sys.m68k Subject: Re: C machine Message-ID: <39aca826.7f32@apollo.uucp> Date: 14 Jan 88 19:42:00 GMT References: <461@auvax.UUCP> <9961@mimsy.UUCP> <166@teletron.UUCP> <6936@brl-smoke.ARPA> <147@ateng.UUCP> Organization: Apollo Computer, Chelmsford, Mass. Lines: 25 >Why would a compiler vendor for the 68000 choose a 32 bit size for an int? Consider: main() { char c[100000],p1,p2; int dp; p1 = &c[0]; p2 = &c[99999]; dp = p2 - p1; } The result of subtracting two pointers is *defined* (K&R) to yield a result of type int. Not long int - int! Any implementation that can not represent this in an int is not an implementation of C. Mind you, any decent 68000 compiler should provide a 16-bit short int, and the code generator should be able to handle a = b + c (all shorts) without converting b & c to ints, adding them, and then converting the result to short. If it is really good it should be able to do the same for a = b + 2.