zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

runtime_invalid_cast_truncate.zig (231B) - Raw


      1 const std = @import("std");
      2 
      3 pub fn main() void {
      4     var spartan_count: u16 = 300; // runtime-known
      5     _ = &spartan_count;
      6     const byte: u8 = @intCast(spartan_count);
      7     std.debug.print("value: {}\n", .{byte});
      8 }
      9 
     10 // exe=fail