# omit safety checks for element access in for loops · gitcafe/zig

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

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

Visibility: public

Requested revision: 74db8c2e8348cb7e9bf264294f73d26be956ea61

Requested commit: 74db8c2e8348cb7e9bf264294f73d26be956ea61

Commit: 74db8c2e8348cb7e9bf264294f73d26be956ea61

Tree: 19e4cf466b86153493adfb8eeded5a16f0db323f

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
omit safety checks for element access in for loops

One of the main points of for loops is that you can safety check the
length once, before entering the loop, and then safely assume that every
element inside the loop is in bounds.

In master branch, the safety checks are incorrectly intact even inside
for loops. This commit fixes it. It's especially nice with multi-object
loops because the number of elided checks is N * M where N is how many
iterations and M is how many objects.

```

## Parents

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

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