Alexis Brodeur c0e5eca6f2 Add initialization helper
When using C libraries, C99 designator list initialization is often
times used to initialize data structure.

While `std.mem.zeroes` and manually assigning to each field can
achieve the same result, it is much more verbose then the equivalent
C code:

```zig
usingnamespace @cImport({
    @cInclude("sokol_app.h");
});

// Using `std.mem.zeroes` and manual assignment.
var app_desc = std.mem.zeroes(sapp_desc);
app_desc.init_cb = init;
app_desc.frame_cb = frame;
app_desc.cleanup_cb = cleanup;
app_desc.width = 400;
app_desc.height = 300;
app_desc.window_name = "no default init";

// Using `std.mem.defaultInit`.
var app_desc = std.mem.defaultInit(sapp_desc, .{
    .init_cb = init,
    .frame_cb = frame,
    .cleanup_cb = cleanup,
    .width = 400,
    .height = 300,
    .window_name = "default init"
});
```

The `std.mem.defaultInit` aims to solve this problem by zero
initializing all fields of the given struct to their zero, or default
value if any.  Each field mentionned in the `init` variable is then
assigned to the corresponding field in the struct.

If a field is a struct, and an initializer for it is present, it is
recursively initialized.
2020-06-01 14:45:35 -04:00
..
2020-04-28 19:11:31 -06:00
2020-04-28 19:11:31 -06:00
2020-05-06 17:08:49 +05:00
2020-05-24 10:04:09 -04:00
2020-05-24 10:04:09 -04:00
2020-05-28 23:10:44 -04:00
2019-09-25 23:35:41 -04:00
2019-09-25 23:35:41 -04:00
2020-01-29 22:22:01 -06:00
2020-04-04 17:37:51 -04:00
2020-05-16 12:41:53 -04:00
2020-05-25 19:46:28 -04:00
2020-05-29 18:30:09 -04:00
2020-02-16 13:25:30 -05:00
2020-05-29 18:30:09 -04:00
2019-10-11 18:13:24 -04:00
2019-09-25 23:35:41 -04:00
2020-05-28 23:10:16 -04:00
2020-05-24 10:04:09 -04:00
2020-02-22 12:44:21 +01:00
2020-05-01 06:47:20 -04:00
2020-06-01 14:45:35 -04:00
2020-05-26 23:26:19 -07:00
2020-05-08 15:10:38 +03:00
2020-05-29 18:30:09 -04:00
2020-05-05 09:38:02 -06:00
2020-05-26 21:34:55 -07:00
2020-06-01 14:43:13 -04:00