# Can I disable the safety checking tag on a bare union without packed?

**URL:** <https://ziggit.dev/t/can-i-disable-the-safety-checking-tag-on-a-bare-union-without-packed/4605>\
**Category:** Help\
**Tags:** language\
**Created:** [June 7, 2024, 1:03am UTC](https://ziggit.dev/t/can-i-disable-the-safety-checking-tag-on-a-bare-union-without-packed/4605 "2024-06-07T01:03:19Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![mnemnion](https://ziggit.dev/user_avatar/ziggit.dev/mnemnion/32/2478_2.png) [@mnemnion](https://ziggit.dev/u/mnemnion)\
**Post date:** [June 7, 2024, 1:42am UTC](https://ziggit.dev/t/can-i-disable-the-safety-checking-tag-on-a-bare-union-without-packed/4605/2 "2024-06-07T01:42:11Z")

</div>

This works:

```zig
// safe union
pub const SafeUnion = union {
    int: i64,
    float: f64,
};

// unsafe union
pub const UnsafeUnion = blk: {
    @setRuntimeSafety(false);
    break :blk union {
        int: i64,
        float: f64,
    };
};

test "safe and unsafe" {
    std.debug.print("\nsize of SafeUnion is {d}\n", .{@sizeOf(SafeUnion)});
    std.debug.print("size of UnsafeUnion is {d}\n", .{@sizeOf(UnsafeUnion)});
}

```

---

_[View the full topic](https://ziggit.dev/t/can-i-disable-the-safety-checking-tag-on-a-bare-union-without-packed/4605)._
