# C backend: Improve lowering of Zig types to C types · gitcafe/zig

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

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

Visibility: public

Requested revision: 51efd553ae94fbf958974284a2f30091e4e1a2fa

Requested commit: 51efd553ae94fbf958974284a2f30091e4e1a2fa

Commit: 51efd553ae94fbf958974284a2f30091e4e1a2fa

Tree: 84f513a2d2cc57ffd0d1b035dac450d25e35a26c

Author: Thomas Ives

Committer: Andrew Kelley

## Message

```
C backend:  Improve lowering of Zig types to C types

1. Changed Zig pointers to functions to be typedef'd so then we can
   treat them the same as other types.

2. Distinguished between const slices (zig_L prefix) and mut slices
   (zig_M prefix).

3. Changed lowering of Zig "const pointers" (e.g. *const u8) to to C
   "pointers to const" (e.g. const char *) rather than C "const
   pointers" (e.g.  char * const)

4. Ensured that all typedefs are "linked" even if the decl doesn't
   require any forward declarations

5. Added test that exercises function pointer type rendering

6. Changed .slice_ptr instruction to allocate pointer local rather than
   a uintptr_t local

```

## Parents

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

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