-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
Description
In C/C++, you can write
struct Point {
float x, y, z;
};In Zig, you have to write
const Point = struct {
x: f32, y: f32, z: f32
};The extra typing required seems like a step backwards, and will be difficult to "sell" to C users.
I propose to go back to using semicolons to separate declarations within structs, and allowing commas to chain fields of the same type.
const Point = struct {
x, y, z: f32;
};This would make all the more sense given Zig's excellent feature of letting the compiler decide the layout of structs: declare your struct members in the order that's easiest to read, without worrying about wasted bytes.
networkimprov
Metadata
Metadata
Assignees
Labels
proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.