# std.builtin.Type: improve ergonomics of \`\*const anyopaque\` fields · gitcafe/zig

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

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

Visibility: public

Requested revision: 89a9cabafd745034871ea014b06bd3bad0505f4a

Requested commit: 89a9cabafd745034871ea014b06bd3bad0505f4a

Commit: 89a9cabafd745034871ea014b06bd3bad0505f4a

Tree: 3d731785b1c66bbbd947911802f6f1c4837490b7

Author: mlugg

Committer: mlugg

## Message

```
std.builtin.Type: improve ergonomics of `*const anyopaque` fields

For representing struct field default values and array/pointer type
sentinel values, we use `*const anyopaque`, since there is no way for
`std.builtin.Type.StructField` etc to refer back to its `type` field.
However, when introspecting a type, this is quite awkward due to the
pointer casts necessary.

As such, this commit renames the `sentinel` fields to `sentinel_ptr`,
and the `default_value` field to `default_value_ptr`, and introduces
helper methods `sentinel()` and `defaultValue()` to load the values.
These methods are marked as `inline` because their return value, which
is always comptime-known, is very often required at comptime by use
sites, so this avoids having to annotate such calls with `comptime`.

This is a breaking change, although note that 0.14.0 is already a
breaking release for all users of `std.builtin.Type` due to the union
fields being renamed.

```

## Parents

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

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