Is there a less safe way to cast integer types?

Hello,
unfortunetly helper functions are your best bet for now.
It really helps to have known destination type so you dont have to use @as() everywhere.

But there are some nice ideas to make it better, especially for game dev purposes: Short math notation, casting, clarity of math expressions - #38 by andrewrk

That said, i have made relatively complex custom rescaling renderer for my game window in Zig and it was much less of a pain point then i tought at first. Actually i had much less bugs in the math logic, thanks to this verbosity of casting. (compared to my past much simpler stuff in C)

1 Like