I have some code that's dealing with a C library, which has some data structure with some_array and some_array_count fields. I would really like to do this:
for (data.some_array[0..data.some_array_count]) |item| {
...
}
But when the array has zero length, the C library will fill it in with a null pointer, and Zig gives me a NPE in debug mode upon trying to iterate through the zero-length "slice" here even though the for loop should just do nothing. Does anyone know what the language rationale behind this decision was/the broader language context? I would love to be able to do this instead of manually indexing which just adds another line of code to do the same thing.