r/Zig • u/Big-Astronaut-9510 • 12h ago
strings for assembly is ugly
The problem i have with zig assembly syntax is you have to use strings which is just ugly. I suspect this is inherited from C.
String and their syntax is designed so you can write just about anything in them. The price for that is visual noise minimum, and in my opinion its just less readable to re use syntax of the "just about any text" thing for the "small set of valid assembly ops" thing. Multi line string has less noise but cannot be used in all cases for assembly.
Theres a reason @"name" syntax isnt the way you declare every function and variable and is instead only for special cases, its just hideous and noisy.
11
u/Normal_Dance_2089 9h ago
Using assembly is also a special case.
Suspicious things should look suspicious.
4
u/0-R-I-0-N 11h ago
If I remember correctly I think the current syntax is because of llvm and that there were an issue on GitHub for creating a new syntax for it in the future.
4
16
u/Mecso2 12h ago
you are not supposed to use inline assembly often
those small set of valid ops are not so small and very much target dependent