Is range(ptrdiff_t) > range(size_t)?

der Mouse mouse at mcgill-vision.UUCP
Thu Aug 11 18:46:03 AEST 1988


In article <485 at draken.nada.kth.se>, pk-tle at nada.kth.se (Tommy Levitte) writes:
>> Is the following relationship always true?
>>      sizeof(char a[]) == &a[sizeof(a)] - &a[0]
> No! If you use any C on a PC system, this will never be true, due to
> the segment:offset adress format.

I believe that ANSI C will require (ie, draft ANSI C does require) that
this be true, and that the compiler arrange whatever is necessary when
subtracting pointers to make it so.

What's this about segment:offset address format?  My idea of a PC is a
MicroVAX-II, at least.  (Oh, you mean *IBM* PC?  Shoulda said so.)

					der Mouse

			uucp: mouse at mcgill-vision.uucp
			arpa: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.lang.c mailing list