# translate-c: non-wrapping operator for pointer arithmetic · gitcafe/zig

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

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

Visibility: public

Requested revision: 5749f706ef866b3c77d6fb8fda9ed08e5c118f58

Requested commit: 5749f706ef866b3c77d6fb8fda9ed08e5c118f58

Commit: 5749f706ef866b3c77d6fb8fda9ed08e5c118f58

Tree: 0f69b721e1728851a685b2596d98c63b88654488

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
translate-c: non-wrapping operator for pointer arithmetic

According to C11 6.5.6.8, pointer arithmetic may not overflow. In fact,
it may not even go more than 1 past the end of an object, or UB occurs.

This is the same as Zig pointer arithmetic semantics, and so the
`+` and `+=` operators rather than `+%` and `+%=` are appropriate for
C-translated pointer arithmetic.

```

## Parents

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

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