Last active
November 9, 2020 16:45
-
-
Save DutchGhost/0205488fe900421cfdd2c60c7a82d4e8 to your computer and use it in GitHub Desktop.
Zutils
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// This piece of code is used whenever the number of iterations is comptime known. | |
/// `n` == iterations. | |
for ([_]u8{0} ** n) |_, i| { | |
} | |
/// This piece of code is used whenever the number of iterations is runtime known. | |
//// `n` == iterations. | |
for (@as([*]u0, undefined)[0..n]) |_, i| { | |
} | |
/// While using the above, beware of (#6947, #6944, #6937, #6936, #6934) | |
/// Use this piece of code when working with allocators | |
var specificAllocator = specificAllcator {}; | |
const allocator = &specificAllocator.allocator;// <-- has type `*Allocator`, but the *pointer* itself is a const variable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment