[comp.lang.c] pointers and integers and ptrdiff_t and long long

karl@haddock.UUCP (Karl Heuer) (06/06/87)

In article <414@sds.UUCP> dave@sds.UUCP (dave schmidt x194) writes:
>In article <3673@gitpyr.gatech.EDU>, allen@gitpyr.gatech.EDU (P. Allen Jensen) writes:
>> [...] The prime also has modes of operation in which
>> pointers are 48 bits even though long, int and float are all 32 bits.
>
>I thought the C language guaranteed that there was an integral type
>large enough to hold any pointer type.

It has already been noted that X3J11 has repealed this.  However, a conforming
compiler must provide integral types "ptrdiff_t" and "size_t".  This brings up
the following trivia question:

Suppose my architecture has a huge address space, and pointers are 64 bits.
In recognition of the idiots who believe "All the World's a VAX", I choose to
make both "int" and "long" 32 bits.  I provide a "long long" for 64-bit
arithmetic.  I typedef "ptrdiff_t" to "signed long long" and "size_t" to
"unsigned long long".  Am I in contempt of standard for having these types,
which are the types of arguments to some standard functions, be larger than
the "largest type" of unsigned long?

Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint
(Yes, I know "long long" is listed as a Common Extension.)