this post was submitted on 08 Jul 2023
5 points (100.0% liked)
Ziglang
65 readers
1 users here now
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Sure, you could do:
Is there a way to write an
i64
literal?If we look at the signature
expectEqual(expected: anytype, actual: @TypeOf(expected)) !void
, notice that the second arg's type depends on the first arg's type.To avoid using
@as
coercion, we can just swap the passing arguments.comptime_int
can be inferred asi64
, not the other way around. And that makes sense because literal values are unsized.