From: utzoo!decvax!harpo!npoiv!npois!cbosgd!mark Newsgroups: net.unix-wizards Title: Re: Information on Unix/Vax peculiarities Article-I.D.: cbosgd.2866 Posted: Mon Dec 6 12:00:22 1982 Received: Tue Dec 7 05:23:57 1982 Reply-To: mark@cbosgd.UUCP (Mark Horton) References: sri-unix.4626 re: I would like to know on what sort of machine you can't put a pointer into an int. Not being able to do that raises all sorts of problems such as not being able to subscript for large arrays or offsets, having the size of function arguments and return values NOT be the sizeof(int), having strange things happen in registers (ints should also have the same size as the registers you'll most often put them in), I quote from page 34 of the C book: int will normally reflet the most "natural" size for a particular machine. ... About all you should count on is that short is no longer than long. It doesn't make any promises that pointers fit in ints. While I recognize that there are programs out there that assume you can (probably the most famous is the execl(2) system call, which uses an integer zero for termination instead of a null character pointer), these should probably be viewed as unportabilities in the specific programs. In answer to your questions: The 68000 has 32 bit pointers, and many people feel that the most natural size for an int is 16 bits. (There are other people who feel that there is so much software that assumes pointers and ints are the same size that's it's worth making ints be 32 bits - both flavors of compiler seem to exist.) I fail to see the problems with the constructs you raise: not being able to subscript for large arrays or offsets, p[i] is defined as *(p+i). A pointer plus an int yields a pointer, that is, 32 bits + 16 bits yields 32 bits. Where's the problem? having the size of function arguments and return values NOT be the sizeof(int), That's true for longs and doubles and structures now. If you're expecting a pointer you should declare that fact in your code. If you're reimplementing printf you should use . having strange things happen in registers Nothing really strange happens when you put a short or char into a long register, (except for sign extension when you didn't want it) on a VAX, why should a 16 bit int by any different? In fact, you're only going to store the least significant 16 bits from the register so it shouldn't matter that more bits were calculated and discarded.