setjmp and typedef'd arrays; thoughts on &array

Steve Dyer sdyer at bbncca.ARPA
Sat Oct 6 13:32:05 AEST 1984


When I first cut my teeth on C, in both the V6 and V7 Ritchie PDP-11 C
compilers, &array was accepted as a valid construct, and one which had
quite different semantics under pointer arithmetic from merely the array
name alone:

if we have

char x[10];

x + 1  points to the second char in the array, equivalent to &x[1].
&x + 1 points to the memory address FOLLOWING the entire array,
equivalent to &x[10].

That is, the size of the object pointed to is equal to the size of
the entire array.  Checking our present compiler, which is derived from
the Ritchie PDP-11 V7 compiler, it behaves in this manner.
-- 
/Steve Dyer
{decvax,linus,ima,ihnp4}!bbncca!sdyer
sdyer at bbncca.ARPA



More information about the Comp.lang.c mailing list