Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

16
  • Where exactly have you seen PTRDIFF_MIN −65535 and PTRDIFF_MAX +65535? These limits are platform dependent, but 65535 seems tiny to me. Commented Mar 26, 2019 at 15:59
  • SIZE_MAX should agree with PTRDIFF_MIN/MAX on the specific implementation to make sense. Commented Mar 26, 2019 at 16:00
  • 1
    -65535 to +65535 is the guaranteed minimum range, actual ranges are of course higher on current systems. Commented Mar 26, 2019 at 16:00
  • 1
    The only way to go I see now is to convert pointers to convert pointers to intptr_t That won't work. You have to convert to uintptr_t or the resulting difference can be incorrect. Then you run into the same problem of not having enough bits to represent the same magnitude along with a direction for the difference. Commented Mar 26, 2019 at 16:42
  • 1
    Unrelated to the main question, but isn't subtraction of two void* undefined? You can't have an array of void objects. Commented Mar 26, 2019 at 17:00