Contiguous Arrays

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Mar 3 08:54:01 AEST 1989


In article <7389 at killer.DALLAS.TX.US> chasm at killer.DALLAS.TX.US (Charles Marslett) writes:
>> The easiest case is if I give you a strictly checking C implementation
>> in which evaluating &space[0]-101 causes your program to terminate
>> with an error diagnostic.
>I did not disagree that it was possible to design a compiler/computer
>combination that had this difficulty -- my point was that given the amount
>of code it was likely to break, would anyone write such a compiler.

There are compilers like that for architectures like that, as
recently explained in detail by somebody else, and reasonably-
written code works fine.  Why do you think it should be valid
to express the address of a nonexistent object?

>Before the recent rounds of Ansi drafts, there was no requirement (oops,
>someone may nail me on this, but if I err in detail, something had to be
>unspecified) that sizeof(xxx) return the size of xxx in units of "char"s.

Yes, the units of "sizeof" weren't specified.  Since all common
early implementations of C chose to use units of chars, too much
code became utterly dependent on sizeof(char)==1.  I argued for
not requiring that in the proposed standard, but was outnumbered
by those who wanted to retroactively bless that assumption.



More information about the Comp.lang.c mailing list