Translate-C doesn't understand that pointers can point to "one past the last element" of an array #22924
Labels
bug
Observed behavior contradicts documented or intended behavior
translate-c
C to Zig source translation feature (@cImport)
Zig Version
0.14.0-dev.2851+b074fb7dd
Steps to Reproduce and Observed Behavior
The C standard allows pointers to point "one past the last element of an array object" for purposes of legal pointer arithmetic and comparison (though not dereferencing, of course). So, the following C code compiles and runs with no errors, warnings, or undefined behavior:
However, translate-c produces zig code that then compiles with the error:
Expected Behavior
Resulting zig code should compile and run, producing a single line of output:
2 3 5 7 11
The text was updated successfully, but these errors were encountered: