[SDL] SDL 2.0 API stabilization

Sik the hedgehog sik.the.hedgehog at gmail.com
Tue Mar 5 16:00:40 PST 2013

Then you break compatibility with just about every program out there
(*every* SDL 2.0 program would need to be changed) as well as
generating a massive inconsistency against other functions of the API
which return 0 on success and another value on error.

It may make more sense to do the opposite: return a mask of subsystems
that *failed* to initialize. Seems counterintuitive, but it could
work. Moreover, it actually follows the whole idea behind returning 0
for success: you can pass the error motive as the non-zero value.
Except that instead of one motive it'd be a bitfield of motives, but
same logic applies.

It'd still probably be wiser to have SDL_INIT_EVERYTHING only include
the bits for the currently existing subsystems and nothing else. Then
we could make it return an error if any non-used flags are passed. Not
sure how useful would that be, though.

2013/3/5, Chris Eineke <libsdl at chriseineke.com>:
> On 13-03-05 02:20 PM, Sik the hedgehog wrote:
>> There's another problem though, SDL will attempt to initialize every
>> subsystem passed, and if *any* fails to initialize, the entire process
>> will fail, even if other subsystems work just fine (because it assumes
>> you *need* all of them). This is why SDL_INIT_EVERYTHING is dangerous.
> SDL_Init shouldn't just return 0 on success, but a mask of sub-systems
> that have been successfully initialized.
> - chris
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

More information about the SDL mailing list