#Any significant difference between `switch` and `comptime switch`?
1 messages · Page 1 of 1 (latest)
inline for does not imply the body runs at comptime, it just means its unrolled
comptime switch forces the switch expression to be evaluated at comptime. inline for creates multiple copies of the loop body at comptime, but the loop body may still compute and switch on runtime values.
comptime switch makes the whole switch comptime not just the condition
right 
so comptime switch works the same as another other comptime expr
yes
i was wondering mostly because im trying to build a semi-generic build script and was using something to the effect of
inline for (sources) |src| {
const step = switch (src.type) {
// ...
}
}
(ofc b.add...() returns a pointer so comptime switch is invalid here but i was curious nonetheless)
keep on mind that build code is effectively comptime already
and that comptime uses an interpreter in the compiler
it's probably faster to not use comptime when possible in build.zig
it will run about once per build anyways
yeah that's fair enough