For more context, please refer to these threads:
The Zig standard library has a variety of useful memory allocators, each carefully designed to address a specific need by employing a specific allocation strategy. The Language Reference has an excellent section on choosing an allocator , which is highly recommended as your go-to reference for this crucial step in Zig software development.
One of these allocators is the page allocator (std.heap.page_allocator), which is often used as a backing-allocator for other higher-level allocators. The pag…
Hello Enjoying Zig for a few days now, love it so far, but have a question regarding allocators. Using v0.12.0 on osx and Ubuntu.
Reading through the docs and going through the zig guide to get started I noticed that most examples use the page_allocator by default and the testing allocator for tests. I also read that one should run without optimizations while developing to get full safety by default and be notified when I forget to deinit() or free() for example.
Now I noticed that when…
Also, you may want to consider looking at functions in the standard library:
std.ascii.toLower
/// Lowercases the character and returns it as-is if already lowercase or not a letter.
pub fn toLower(c: u8) u8 {
const mask = @as(u8, @intFromBool(isUpper(c))) << 5;
return c | mask;
}
3 Likes