Not-Nik / raylib-zig

Manually tweaked, auto-generated raylib bindings for zig. https://github.com/raysan5/raylib
MIT License
693 stars 122 forks source link

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

Open MGilleronFJ opened 4 months ago

MGilleronFJ commented 4 months ago

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 commented 4 months ago

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

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