Hacker News new | ask | show | jobs
by mh7 1274 days ago
Does zig plan on not supporting microcontrollers or not using "/" for integer division?

Because on your typical arm mcu, x/y is a function call to a definitively non-constant time function.

And lets not forget soft-fp. Every single floating point op is a function call...

1 comments

A better way to think about it is: for a given line of code, how much context do you need in order to understand what function is actually going to be called? Yes, some compiler-rt or soft-fp function might get called but you know that's happening and what it does.

With most languages you need significantly more context than you do in Zig - in C you need to know what preprocessor shenanigans might be going on; in C++ pretty much anything could be happening (operator overloads, virtual functions, constructors, destructors, who knows what else). With Rust you need to know what traits are imported, and if proc macros are involved then anything goes.