# Make \`@typeInfo\` return null-terminated strings · gitcafe/zig

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

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

Visibility: public

Requested revision: a02bd81760166d679ccee0e190bf62115272ffbe

Requested commit: a02bd81760166d679ccee0e190bf62115272ffbe

Commit: a02bd81760166d679ccee0e190bf62115272ffbe

Tree: e800cf9fec8bf55898a966ca2bae2d4707707db2

Author: Carl Åstholm

Committer: Carl Åstholm

## Message

```
Make `@typeInfo` return null-terminated strings

Changes the types of `std.builtin.Type` `name` fields from `[]const u8`
to `[:0]const u8`, which should make them easier to pass to C APIs
expecting null-terminated strings.

This will break code that reifies types using `[]const u8` strings, such
as code that uses `std.mem.tokenize()` to construct types from strings
at comptime. Luckily, the fix is simple: simply concatenate the
`[]const u8` string with an empty string literal (`name ++ ""`) to
explicitly coerce it to `[:0]const u8`.

Co-authored-by: Krzysztof Wolicki <der.teufel.mail@gmail.com>

```

## Parents

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

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