Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

Conversation

@gwenzek
Copy link

@gwenzek gwenzek commented Nov 25, 2025

Add the floating points literals that weren't handled:

  • F32, F32x, F64, F64x: converted to respectively f32, f64, f64, f80
  • BF16 -> still compileError because it's not yet supported by Zig (see BFLOAT16 support zig#3148 )

Comment on lines 359 to 360
// Zig doesn't support BFloat16, so the best thing we can do is convert it to u16,
// so that the value is bit-to-bit identic between the emitted Zig and original C code.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless you have a specific use case I'd like to avoid adding workarounds for types that aren't supported by Zig yet.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My use case is that I import a header file that contains such constant. How should translate-c handle that ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Letting it go to that else branch would turn those macros into @compileErrors.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I also upgraded the PR description.

.None, .F32x, .F64 => "f64",
.L => "c_longdouble",
.W => "f80",
.W, .F64x => "f80",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F64x should be long double.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants