Skip to content
New issue

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

Tracked series of breaking changes in Zig master #49

Merged
merged 4 commits into from
Jul 20, 2023

Conversation

JimnwQ
Copy link

@JimnwQ JimnwQ commented Jul 10, 2023

Current zig master version is 0.11.0-dev.3952+82a9d5d78.

All codes including examples are compiling with no errors.

Tracked:

@Sobeston Sobeston mentioned this pull request Jul 15, 2023
Copy link
Owner

@ifreund ifreund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nicely done, thanks for taking the time to put this together!

@@ -35,7 +35,7 @@ pub const Array = extern struct {
pub fn slice(array: Array, comptime T: type) []T {
const data = array.data orelse return &[0]T{};
// The wire protocol/libwayland only guarantee 32-bit word alignment.
const ptr = @ptrCast([*]T, @alignCast(4, data));
const ptr: [*]T = @ptrCast(@alignCast(data));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change as-is will no longer give a compile error if the alignment of T is greater then 4 but rather silently fail at runtime.

I think I'll change this function to return []align(4) T and let the user of zig-wayland handle underalignment as they like.

@ifreund ifreund merged commit c2ae318 into ifreund:next-zig Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants