# std.mem.asBytes: fix footgun when passing non-single pointer · gitcafe/zig

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

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

Visibility: public

Requested revision: 24babde746621492c5111ffcd8edf575cb176d65

Requested commit: 24babde746621492c5111ffcd8edf575cb176d65

Commit: 24babde746621492c5111ffcd8edf575cb176d65

Tree: c5f7affd52d47632874da1f533c888ef648e8304

Author: mlugg

Committer: mlugg

## Message

```
std.mem.asBytes: fix footgun when passing non-single pointer

I was just bitten by this footgun, where I actually wanted
`sliceAsBytes` but unintentionally used `asBytes`, which in practice
ignored all but the first element. Just add a comptime assertion to
trigger a compile error in this case.

```

## Parents

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

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