Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Zig allows any uX and iX in the range of 1 - 65,535, as well as u0


u0?? Why?


Sounds like zero-sized types in Rust, where it is used as marker types (eg. this struct own this lifetime). It also can be used to turn a HashMap into a HashSet by storing zero sized value. In Go a struct member of [0]func() (an array of function, with exactly 0 members) is used to make a type uncomparable as func() cannot be compared.


To avoid corner cases in auto-generated code?


To represent 0 without actually storing it in memory




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: