# translate-c: Add support for pointer subtraction · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/4f11a88b9f21a365cf2281e840ed12b0d4e687a6)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 4f11a88b9f21a365cf2281e840ed12b0d4e687a6

Requested commit: 4f11a88b9f21a365cf2281e840ed12b0d4e687a6

Commit: 4f11a88b9f21a365cf2281e840ed12b0d4e687a6

Tree: 2cdfb246283630b20a5ab1753175d4e724f42c3c

Author: Evan Haas

Committer: Veikka Tuominen

## Message

```
translate-c: Add support for pointer subtraction

When two pointers are subtracted, both shall point to elements of the
same array object, or one past the last element of the array object;
the result is the difference of the subscripts of the two array elements.

The size of the result is implementation-defined, and its type
(a signed integer type) is ptrdiff_t defined in the <stddef.h> header.
If the result is not representable in an object of that type,
the behavior is undefined.

See C Standard, §6.5.6 [ISO/IEC 9899:2011]

Fixes #7216

```

## Parents

- [53cc63f0c91ce9f6f9c81f87e2673c5adfe1afe7](https://git.cafe/gitcafe/zig/commit/53cc63f0c91ce9f6f9c81f87e2673c5adfe1afe7?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/4f11a88b9f21a365cf2281e840ed12b0d4e687a6?format=markdown)
