Open changrui opened 4 years ago
this language really hard, i not even can alloc some memory for trying base64 example :)
var allocator = std.heap.HeapAllocator.init();
var buf = try std.Buffer.initSize(allocator, count);
zig-macos-x86_64-0.5.0/lib/zig/std/heap.zig:335:13: error: Unsupported OS
else => @compileError("Unsupported OS"),
https://ziglang.org/documentation/master/#Choosing-an-Allocator
why does your base64 example need to allocate memory?
@kostya I agree that the coding in Zig could be a little bit challenging as the documentation is not comprehensive yet. Looks like the best approach is using the Zig source code itself as the reference (it has the internal tests within which are very useful and helped me create #188).
As for the HeapAllocator, it works only for Windows (https://github.com/ziglang/zig/blob/master/lib/std/heap.zig#L239), therefore in my PR I've used direct_allocator. The code compiles and works in both GNU/Linux and macOS.
https://ziglang.org https://github.com/ziglang/zig
Thanks.