blob: b274184b807b4b54c19db7f9f7c0d1956844b79e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
export executable "structs";
use "std.zig";
// Note: this example is not working because codegen is confused about
// how byvalue structs which are in memory on the stack work
export fn main(argc : isize, argv : *mut *mut u8, env : *mut *mut u8) -> i32 {
let mut foo : Foo;
foo.a = foo.a + 1;
foo.b = foo.a == 1;
test_foo(foo);
return 0;
}
struct Foo {
a : i32,
b : bool,
c : f32,
}
fn test_foo(foo : Foo) {
if foo.b {
print_str("OK" as string);
}
}
|