Pointers and Arrays

Jonathan Leech jon at amdahl.UUCP
Fri Aug 8 05:51:14 AEST 1986

In article <513 at hadron.UUCP>, jsdy at hadron.UUCP (Joseph S. D. Yao) writes:
> I have seen several references to the address of an array vs.
> the address of the first element of the array.  Would someone
> care to address what they think this difference is, aside from
> data type?  I.e., it is clear that the types *int and *(int[])
> should be different.  But the values should be the same:
> 	int countdown[] = { 10, 9, 8, ... };
> 		gives something like
> 	_countdown:
> 	=>	.word 10
> 		.word 9
> 		.word 8
> 		...
> The values of both addresses should be the address of the word
> '10'.
> Well, yes, in some theoretical architectures I've heard tell of
> pointers include arbitrary information on e.g. the size of the
> object.  Any of these actually implemented?

    You could implement pointers as a triple:

    (low address, length, offset of current member)

    for range checking. Doesn't the Symbolics machine do something like
this? I recall a reference in a C compiler manual for the Symbolics but
have never actually used the machine or compiler.

    -- Jon Leech (...seismo!amdahl!jon)
    UTS Products / Amdahl Corporation

More information about the Comp.lang.c mailing list