# Wierd differnce between Vector and array on 0.17.0

**URL:** <https://ziggit.dev/t/wierd-differnce-between-vector-and-array-on-0-17-0/17061>\
**Category:** Help\
**Tags:** language, c\
**Created:** [August 3, 2026, 6:03pm UTC](https://ziggit.dev/t/wierd-differnce-between-vector-and-array-on-0-17-0/17061 "2026-08-03T18:03:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wunka](https://ziggit.dev/user_avatar/ziggit.dev/wunka/32/7510_2.png) [@Wunka](https://ziggit.dev/u/Wunka)\
**Post date:** [August 3, 2026, 6:03pm UTC](https://ziggit.dev/t/wierd-differnce-between-vector-and-array-on-0-17-0/17061/1 "2026-08-03T18:03:19Z")

</div>

While trying to make a version of [Cubyz](https://github.com/PixelGuys/Cubyz) that works with zig 0.17.0 (master) I got very weird graphical artifacts and could track it down to this reproduce:

```zig
const std = @import("std");

pub fn glCall(a: [*c]c_int) void {
    a[0] = 0;
}

pub fn main() !void {
    var resultArr: [2]i32 = undefined;
    glCall(&resultArr[0]);
    glCall(&resultArr[1]);
    std.debug.print("resultArr: {any}\n", .{resultArr});
    
    var resultVec: @Vector(2, i32) = undefined;
    glCall(&resultVec[0]);
    glCall(&resultVec[1]);
    std.debug.print("resultVec: {any}\n", .{resultVec});
}

```

(code is heavly inspired by the actual code, maybe there is a better reproduce)  
Output:

```zig
resultArr: { 0, 0 }
resultVec: { 0, -1431655766 }

```

This seems like a bug, but maybe I just missed some breaking change?

Maybe to clarify. with 0.16.0 the array and the vector variant have the same output

---

<div class="post-metadata">

**Author:** ![WeeBull](https://ziggit.dev/user_avatar/ziggit.dev/weebull/32/6828_2.png) [@WeeBull](https://ziggit.dev/u/WeeBull)\
**Post date:** [August 3, 2026, 6:52pm UTC](https://ziggit.dev/t/wierd-differnce-between-vector-and-array-on-0-17-0/17061/2 "2026-08-03T18:52:55Z")

</div>

You seem to be on to something. Zig 0.17 only calls `glCall` 3 times rather than 4..

> **[Compiler Explorer - Zig](https://godbolt.org/z/a47oWoWsr)**
>
> const std = @import("std");
> 
> pub fn glCall(a: \[\*c\]c\_int) void {
> a\[0\] = 0;
> }
> 
> export fn main() i32 {
> var resultArr: \[2\]i32 = undefined;
> glCall(&resultArr\[0\]);
> glCall(&resultArr\[1\]);
>     
> var resultVec: @Vector(2, i32) =...

I removed the `std.debug.print()` to get the reproduction case to be tiny.

---

<div class="post-metadata">

**Author:** ![mlugg](https://ziggit.dev/user_avatar/ziggit.dev/mlugg/32/437_2.png) [@mlugg](https://ziggit.dev/u/mlugg)\
**Post date:** [August 3, 2026, 7:53pm UTC](https://ziggit.dev/t/wierd-differnce-between-vector-and-array-on-0-17-0/17061/3 "2026-08-03T19:53:57Z")

</div>

The compiler bug here is that this code shouldn’t compile! Vectors are allowed to have weird non-byte-aligned layouts, so pointers to their elements have special types which aren’t meant to be compatible with normal pointer types, such as your `[*c]c_int`. ~~Would you mind opening an issue on the Zig repository?~~ EDIT: actually, I just filed it myself, as [#36378](https://codeberg.org/ziglang/zig/issues/36378).

By the way, never use `[*c]T` types in your own code! C pointer types exist _only_ to be generated by translate-c. When writing code manually, it can and should always be replaced with a more specific pointer type, usually either `*T` or `[*]T`.

---

<div class="post-metadata">

**Author:** ![Wunka](https://ziggit.dev/user_avatar/ziggit.dev/wunka/32/7510_2.png) [@Wunka](https://ziggit.dev/u/Wunka)\
**Post date:** [August 3, 2026, 8:28pm UTC](https://ziggit.dev/t/wierd-differnce-between-vector-and-array-on-0-17-0/17061/4 "2026-08-03T20:28:43Z")

</div>

Ah that makes sense.  
And no worries `glCall` was just supposed to mimic a function generated by translateC which is in the actual code used.

---

<div class="post-metadata">

**Author:** ![WeeBull](https://ziggit.dev/user_avatar/ziggit.dev/weebull/32/6828_2.png) [@WeeBull](https://ziggit.dev/u/WeeBull)\
**Post date:** [August 4, 2026, 3:20pm UTC](https://ziggit.dev/t/wierd-differnce-between-vector-and-array-on-0-17-0/17061/5 "2026-08-04T15:20:00Z")

</div>

> [@Wunka](#):
>
> `glCall` was just supposed to mimic a function generated by translateC

I’d assumed it was an OpenGL function with that name.

---

<div class="post-metadata">

**Author:** ![Wunka](https://ziggit.dev/user_avatar/ziggit.dev/wunka/32/7510_2.png) [@Wunka](https://ziggit.dev/u/Wunka)\
**Post date:** [August 4, 2026, 4:40pm UTC](https://ziggit.dev/t/wierd-differnce-between-vector-and-array-on-0-17-0/17061/6 "2026-08-04T16:40:39Z")

</div>

You caught me

---

<div class="post-metadata">

**Author:** ![WeeBull](https://ziggit.dev/user_avatar/ziggit.dev/weebull/32/6828_2.png) [@WeeBull](https://ziggit.dev/u/WeeBull)\
**Post date:** [August 5, 2026, 3:54pm UTC](https://ziggit.dev/t/wierd-differnce-between-vector-and-array-on-0-17-0/17061/7 "2026-08-05T15:54:30Z")

</div>

Think it’s been fixed.

[https://codeberg.org/ziglang/zig/pulls/36097](https://codeberg.org/ziglang/zig/pulls/36097)
