sizeof

cottrell at nbs-vms.ARPA cottrell at nbs-vms.ARPA
Tue Feb 5 08:02:12 AEST 1985


/*
> > Someone also said that ptr's to different objex may be different sizes.
> > Where & why?
> 
> Where:
> 
> On a Zilog 8000 running in segmented mode (24-bit pointers).
> On a Motorola 68000.
> On an Intel 802*8[68] running large-model code.
> Just because a machine supports large pointers doesn't mean that it
> supports 32-bit arithmetic well.  The Z8000 probably does 32-bit
> arithmetic 16 bits at a time.  The 68000 definitely does, and can't do
> 32-bit multiplies or divides conveniently at all.

The 68000 only uses 24 bits for addressing, but uses them either
1) as a 32 bit item in the instruxion stream, & 2) in a 32 bit register.
While it would be possible for an implementor to use only 3 bytes, the 
space saved would be offset by the overhead in loading into a four byte
register & masking. The 24 bit restrixion is only temporary anyway.
Future versions will probably allow 32 bits. I think the SUN mmu
axually uses these bits. I think the z8000 has 32 bit regs too.

> Why:
> 
> Because it doesn't say anywhere that you can't.  Because you may not want
> to pay the penalty for 32-bit arithmetic.

If you have a machine with an address space > 64k, you probably have
32 bit registers.

> > I realize that a certain machine may desire this to make implementation
> > as efficient as possible, but I think the designers should just bite
> > the bullet and make all ptr's the same size.
> 
> On this point, I agree.  16-bit "int"s make techniques like using "malloc"
> and "realloc" to grow a large table (used by such obscure programs as "nm")
> lose big.

I just read a news item from yourself which stated:
	"THERE IS NO SUCH THING AS A GENERIC NULL POINTER"
Presumably because of different length pointers. Which way do you want it?
> 
> 	Guy Harris
> 	{seismo,ihnp4,allegra}!rlgvax!guy
*/



More information about the Comp.lang.c mailing list