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

*anyopaque struct members aren't checked for null pointers #118

Open
MGilleronFJ opened this issue Jul 4, 2024 · 1 comment
Open

*anyopaque struct members aren't checked for null pointers #118

MGilleronFJ opened this issue Jul 4, 2024 · 1 comment

Comments

@MGilleronFJ
Copy link

MGilleronFJ commented Jul 4, 2024

In Raylib, Image.data can be checked for null in case loading an image failed: https://github.com/raysan5/raylib/blob/9a280cda0be211ee751cdb44fedab8f1e698be2a/src/rtextures.c#L4156

But in the bindings, data is *anyopaque, and Zig seems to not allow comparing it with null. Maybe it should be ?*anyopaque? Or loadImage could return an error? (depending on how thin the bindings should be)

@Not-Nik
Copy link
Owner

Not-Nik commented Jul 6, 2024

I think returning an error would me more "Zig like", but it requires creating an extra struct for each type this affects. These are

  • Image
  • Wave
  • Music

I'll see if I can come up with an elegant solution for this, without requiring much manual intervention

@Not-Nik Not-Nik changed the title rl.Image.data should be nullable *anyopaque struct members aren't checked for null pointers Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants