Assert vs comptime if

The architecture should be comptime-known. We would have to see the code, but there’s probably a missing comptime somewhere. The compiler will treat things as comptime when it can, but sometimes it fails to notice that something is indeed comptime, and you need the keyword to enforce it. The assertion is doing its job here. If you remove the assertion and the code compiles, there’s a good chance that function will end up in the binary. Not only is this wasted space, but there could be a code path that leads to this function when it shouldn’t.

3 Likes