[cfe-commits] r89343 - /cfe/trunk/lib/Headers/stdint.h

Ken Dyck Ken.Dyck at onsemi.com
Thu Nov 19 12:29:41 PST 2009


> On Thursday, November 19, 2009 1:41 PM, Sean Hunt wrote
> 
> On Thu, Nov 19, 2009 at 11:30 AM, Ken Dyck 
> <Ken.Dyck at onsemi.com> wrote:
> > On Thursday, November 19, 2009 11:26 AM, Chris Lattner wrote:
> >>
> >> Are the ptrdiff types ever actually different from the 
> intptr types?
> >
> > Not on any of the architectures that llvm currently targets. Or any 
> > architecture that I know of, for that matter. On the other 
> hand, the C 
> > standard, as far as I understand it, allows the two types to vary 
> > independently.
> 
> I could conceive of an architecture where ptrdiff_t is a size 
> bigger than intptr_t in order to be able to accurately 
> represent any pointer subtraction. On the other hand, I can't 
> really conceive of a situation of where you'd use more than 
> half your memory on the same array and still be willing to 
> spare a byte to hold a subtraction.

I suppose another possibility would be some kind of application-specific
co-processor that shares a small region of memory with a host processor.
If the co-processor keeps the host's pointer representation to ease
passing pointers between the two, it might need a larger intptr_t than
its ptrdiff_t.

-Ken




More information about the cfe-commits mailing list