Not-Nik / raylib-zig

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

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

Open MGilleronFJ opened 2 weeks ago

MGilleronFJ commented 2 weeks 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 2 weeks 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