Whose code should we break? ( was Re: 64 bit C )

Curtis Yarvin cgy at cs.brown.edu
Wed Feb 20 05:57:37 AEST 1991


In article <1215 at dms.UUCP> albaugh at dms.UUCP (Mike Albaugh) writes:
>From article <MARC.91Feb14085851 at marc.watson.ibm.com>, by marc at marc.watson.ibm.com (Marc Auslander):
>> Anyone out there for sizeof int == 4?
>
>	K&R defined 'int' to be the "natural" size for values that have
>no particular size requirement, other than being "big enough" :-) Anyway,
>because some yahoos decided that sizeof(int) == sizeof( char *) a _long_
>time ago, and because Motorola decided making the 68000 and "almost" 32-bit
>machine, and because compiler vendors (perhaps justifiably) decided to make
>sizeof(int) == 4 for the 68K, _I'm_ stuck porting a whole bunch of code
>crawling with "register short i,j,k" to a 32-bit machine, whose compiler
>obligingly does a truncate after every "++i" in a loop :-(

I use "short" for integers on the 68k too.  But "register short"?  That's
human error.  The 68k does, after all, have 32-bit registers.

>	PLEASE DON'T LIE ABOUT THE SIZE OF YOUR INT. You will penalize
>thoughtful competent programmers who thought about portability and growth
>to reward lazy "all the world's a vax" (tm) hackers.

I don't give a damn how big int is; I use int only when I don't care.

But I want sizeof long == sizeof char *.  There are quite a few applications
in which I find myself writing my own memory manager; I need some type
in which I can flick the bits on my pointers, portably.

curtis

"I tried living in the real world
 Instead of a shell
 But I was bored before I even began." - The Smiths



More information about the Comp.lang.c mailing list