#Translate C error regarding c_int and bool

1 messages · Page 1 of 1 (latest)

modern garnet
#

I get the following error when compiled a translate-c output generated by Zig:

error: incompatible types: 'c_int' and 'bool'
    ret &= !(overflow != 0);

If I inspect this file, both ret and overflow have type c_int

I guess makes sense, but does this mean that the translate-c tool generates translations that can't be compiled?
Is there any workaround?

#

Uhm, I guess I could edit the file and add @intFromBool... not ideal since I'd be touching the generated file.
I guess I could copy-paste it, fix it, and use that, instead of relying on generation.

I just wonder if this might be a bug or I can rescue the idea of relying on generation.

#

I also have another error:

error: @bitCast size mismatch: destination type 'u32' has 32 bits but source type 'u1' has 1 bits
        c2 +%= @as(u32, @bitCast(@intFromBool(c0 < tl2) & @intFromBool(th2 == @as(u32, @bitCast(@as(c_int, 0))))));

Not sure why this bitCast was generated there... if the return is u1 that should let @as work correctly.

So I guess maybe another bug?