While trying out allyourcodebase/sdl, I noticed some functions return a ?*T (e.g. pub extern fn SDL_CreateWindow(title: [*c]const u8, w: c_int, h: c_int, flags: SDL_WindowFlags) ?*SDL_Window), while others return a [*c]T (e.g. pub extern fn SDL_LoadBMP(file: [*c]const u8) [*c]SDL_Surface)
When looking at the C header definitions, I couldn’t find any noticeable differences that could lead to this.
SDL_surface.h:
extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP(const char *file);
SDL_video.h:
extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, int w, int h, SDL_WindowFlags flags);
However, struct SDL_Window’s definition is nowhere to be found (and is translated as opaque in Zig), while struct SDL_Surface is (and is translated as extern struct).
Is it because without knowing the size of struct SDL_Window, there’s no way it could be pointing to a user-facing array, so it must be a (nullable) single-item pointer?