#Force runtime evaluation of a function
1 messages · Page 1 of 1 (latest)
to make sure the function isnt' being run at comptime add this to the start of the function body
if(@inComptime()) @compileError("");
to make sure the compiler isn't optimizing the call out, maybe wrap the call like this: std.mem.doNotOptimizeAway(someFn());
Lets say my function returns a u32, how would I get the return value when wrapping th function in std.mem.doNotOptimizeAway?
const x = someFn();
std.mem.doNotOptimizeAway(x):
thanks! Will try!