Path: utzoo!utgpu!attcan!uunet!husc6!bloom-beacon!gatech!psuvax1!blitz.cs.psu.edu!flee From: flee@blitz.cs.psu.edu (Felix Lee) Newsgroups: comp.lang.c Subject: Is range(ptrdiff_t) > range(size_t)? Message-ID: <3740@psuvax1.cs.psu.edu> Date: 27 Jul 88 20:06:30 GMT Sender: news@psuvax1.cs.psu.edu Organization: Penn State University Computer Science Lines: 13 Harbison&Steele (2e) says (p. 156) > Some implementations of C use int or long int as the type of the > result of sizeof, but this is an inferior choice because it may be > impossible to represent the size of a very large array, say one that > spans more than half the total address space. But such a large array breaks ptrdiff_t. Is ptrdiff_t required to have a larger range than size_t? Can you stuff a size_t value into a ptrdiff_t variable without overflow? Is the following relationship always true? sizeof(char a[]) == &a[sizeof(a)] - &a[0] -- Felix Lee *!psuvax1!flee