# translate-c: Fix casting of function pointers · gitcafe/zig

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

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

Visibility: public

Requested revision: ae15022406e5d59787195130cfd5261c6336f41c

Requested commit: ae15022406e5d59787195130cfd5261c6336f41c

Commit: ae15022406e5d59787195130cfd5261c6336f41c

Tree: ff5184e7f432c08496bcbee186f5c5856c6efca1

Author: LemonBoy

Committer: LemonBoy

## Message

```
translate-c: Fix casting of function pointers

The @ptrCast(X, @alignCast(@alignOf(T), Y)) pattern is only correct if T
is not a function type or a pointer, in that case the @alignOf refers to
the pointer itself and not to the pointee type.

```

## Parents

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

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