≈ the.bay.news

Why not Make `[*]T` an at-least-one many-item pointer?

Ziggit
Why not Make `[*]T` an at-least-one many-item pointer?
Make [*]T an at-least-one many-item pointer A silly thing I found recently in Zig! I got an invalid pointer. I just put a many-item pointer [*]T in my function signature, and in the function body I dereferenced this pointer, and then it broke. I found that we need @ptrCast to cast [*]T to *T. What the hell? A many-item pointer can naturally be converted to a single-item pointer. Also, I just get the ptr from []T, which seems fine, but when the []T is empty, it does not return null; it giv...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.