this post was submitted on 08 Jul 2023
5 points (100.0% liked)
Ziglang
63 readers
1 users here now
founded 1 year 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.