# Add \`union\` support to the C backend\. · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/587a4437dbe4518671f4a894edb7d0f8e51d2ee1)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 587a4437dbe4518671f4a894edb7d0f8e51d2ee1

Requested commit: 587a4437dbe4518671f4a894edb7d0f8e51d2ee1

Commit: 587a4437dbe4518671f4a894edb7d0f8e51d2ee1

Tree: c93f9148fce23702ca11d871d7847b3e71f8e88c

Author: Cody Tapscott

Committer: Cody Tapscott

## Message

```
Add `union` support to the C backend.

There are some differences vs. the union encoding in the LLVM backend:
   - Tagged unions with a 0-bit payload do not become their tag type. Instead,
     they are a struct with an empty `union` as their payload field.
   - We do not order the `payload`/`tag` storage based on their alignment

```

## Parents

- [983dfcd3fbd70347537f7b63db9838848caf0ac0](https://git.cafe/gitcafe/zig/commit/983dfcd3fbd70347537f7b63db9838848caf0ac0?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/587a4437dbe4518671f4a894edb7d0f8e51d2ee1?format=markdown)
