You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As seen in #977, the tag types of enums in the C spec is unreliable. @isaachier even points out that many C projects avoid the C enum so they can ensure that their lib is "ABI-able".
But Zig has explicit tag types for enums, so when fixing up code translated with translate-c, we should be able to replace code such as this:
typedef E uint32_t;
enum { A, B, C };
struct S {
E e;
};
With:
pub const E = enum(u32) { A, B, C };
pub const S = extern struct {
e: E,
};
Sadly, this is not allowed:
test.zig:3:5: error: extern structs cannot contain fields of type 'E'
e: E,
The text was updated successfully, but these errors were encountered:
andrewrk
added
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
accepted
This proposal is planned.
labels
Apr 12, 2019
As seen in #977, the tag types of enums in the C spec is unreliable. @isaachier even points out that many C projects avoid the C enum so they can ensure that their lib is "ABI-able".
But Zig has explicit tag types for enums, so when fixing up code translated with translate-c, we should be able to replace code such as this:
With:
Sadly, this is not allowed:
The text was updated successfully, but these errors were encountered: