my ziglings
0

Configure Feed

Select the types of activity you want to include in your feed.

Update outdated comments

lording (Jun 22, 2023, 12:11 PM UTC) d52f3607 3e502fe6

+7 -7
+2 -2
exercises/036_enums2.zig
··· 6 6 // const Stuff = enum(u8){ foo = 16 }; 7 7 // 8 8 // You can get the integer out with a builtin function, 9 - // @enumToInt(). We'll learn about builtins properly in a later 9 + // @intFromEnum(). We'll learn about builtins properly in a later 10 10 // exercise. 11 11 // 12 - // const my_stuff: u8 = @enumToInt(Stuff.foo); 12 + // const my_stuff: u8 = @intFromEnum(Stuff.foo); 13 13 // 14 14 // Note how that built-in function starts with "@" just like the 15 15 // @import() function we've been using.
+1 -1
exercises/064_builtins.zig
··· 4 4 // Ziglings exercise. 5 5 // 6 6 // We've also seen @intCast() in "016_for2.zig", "058_quiz7.zig"; 7 - // and @enumToInt() in "036_enums2.zig". 7 + // and @intFromEnum() in "036_enums2.zig". 8 8 // 9 9 // Builtins are special because they are intrinsic to the Zig 10 10 // language itself (as opposed to being provided in the standard
+4 -4
exercises/065_builtins2.zig
··· 1 1 // 2 2 // Zig has builtins for mathematical operations such as... 3 3 // 4 - // @sqrt @sin @cos 5 - // @exp @log @floor 4 + // @sqrt @sin @cos 5 + // @exp @log @floor 6 6 // 7 7 // ...and lots of type casting operations such as... 8 8 // 9 - // @as @intToError @intToFloat 10 - // @intToPtr @ptrToInt @enumToInt 9 + // @as @errorFromInt @floatFromInt 10 + // @ptrFromInt @intFromPtr @intFromEnum 11 11 // 12 12 // Spending part of a rainy day skimming through the complete 13 13 // list of builtins in the official Zig documentation wouldn't be