|
|
|
|
|
by uecker
379 days ago
|
|
I haven't looked at the more complex example, but the second issue is not too difficult to fix:
https://godbolt.org/z/48T44PvzK For complicated things, I haven't really understood the advantage compared to simply running a program at build time. |
|
> I haven't really understood the advantage compared to simply running a program at build time.
Since both comptime and runtime code can be mixed, this gives you a lot of safety and control. The comptime in zig emulates the target architecture, this makes things like cross-compilation simply work. For program that generates code, you have to run that generator on the system that's compiling and the generator program itself has to be aware the target it's generating code for.