We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
To see the LLVM IR, use clang -nostdlib -S -g -emit-llvm test.c:
clang -nostdlib -S -g -emit-llvm test.c
#include <inttypes.h> // %struct.Foo = type { %union.anon, i8 } // %union.anon = type { i64, [8 x i8] } // ABI Size: 24 struct Foo { union { uint64_t a; uint8_t b[9]; } bar; uint8_t c; }; int main(void) { struct Foo foo; return 0; }
For this tagged union, the C version will have ABI size = 24. However, when written in zig:
// %struct.Foo = type { i64, [1 x i8], i8 } // ABI Size: 16 const Foo = union(enum) { a: u64, b: [9]u8, };
A savings of 8 bytes for this case.
This will require implementing the above LLVM type. Currently, Zig matches the equivalent C code.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
To see the LLVM IR, use
clang -nostdlib -S -g -emit-llvm test.c
:For this tagged union, the C version will have ABI size = 24. However, when written in zig:
A savings of 8 bytes for this case.
This will require implementing the above LLVM type. Currently, Zig matches the equivalent C code.
The text was updated successfully, but these errors were encountered: