In the following code, a TAB char is in s
. The code doesn’t compile now:
pub fn main() !void {
// const s = " "
}
zig version: 0.14.0-dev.1951+857383689
In the following code, a TAB char is in s
. The code doesn’t compile now:
pub fn main() !void {
// const s = " "
}
zig version: 0.14.0-dev.1951+857383689
I think this was not done on purpose.
Sadly, it was done on purpose. In the specs it says that tabs inside of comments and multi-line string literals are illegal: grammar clarifications regarding tabs and carriage returns · Issue #38 · ziglang/zig-spec · GitHub
And this has been implemented recently in std.zig.tokenizer: simplification and spec conformance by andrewrk · Pull Request #20885 · ziglang/zig · GitHub
It’s kind of annoying in my opinion and I hope they revert it.
But I guess in your case you can fix it by using \t
instead of putting the tab directly into the string literal (and to be honest tabs in string literals are kind of ugly anyways).