There was a discussion about this not long ago.
The TL;DR is that if the function has side-effects, so you can safely do this without worrying about it being optimized away if you are relying upon it performing some change of state. This is due to the nuance between C/C++ often using macros for assert, while Zig uses traditional function calls.