# translate-c: call @boolToInt on return value when necessary · gitcafe/zig

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

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

Visibility: public

Requested revision: a2ec77041bc4a58d922cd3f8db923b7272b1f8f7

Requested commit: a2ec77041bc4a58d922cd3f8db923b7272b1f8f7

Commit: a2ec77041bc4a58d922cd3f8db923b7272b1f8f7

Tree: 2543c29e0d80afe56639e5bcaad1942eb2f939f8

Author: Evan Haas

Committer: Veikka Tuominen

## Message

```
translate-c: call @boolToInt on return value when necessary

In C, if a function has return type `int` and the return expression
is a boolean expression, there is no implicit cast. Therefore the
translated Zig code needs to call @boolToInt() on the result.

Written with feedback from @Vexu

Fixes #6215

```

## Parents

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

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