[SDL] SDL 2.0 API stabilization

Sik the hedgehog sik.the.hedgehog at gmail.com
Tue Mar 5 11:20:56 PST 2013


You can still pass all flags at the same time if you want, no need to
use SDL_InitSubsystem for each.

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.

The above gets even more troublesome in the case Ryan mentioned
originally, if a new subsystem is added (and I have the feeling that's
bound to happen with so many new I/O things coming out lately) then
SDL_INIT_EVERYTHING will result in failure on any system not
supporting all of the subsystems. Also it will cause issues if a new
platform is ever added, because most likely it won't support all of
the subsystems at the same time (and depending on what peripherals it
supports, it may never do it).

2013/3/5, Alfred Reynolds <Alfred at valvesoftware.com>:
> I find SDL_INIT_EVERYTHING useful, I have a base engine function that turns
> SDL on and off at the correct point in engine execution, and then all the
> leaf code is free to use SDL as it sees fit. Having each user of SDL
> functionality have to initialize (and de-init) the subsystem they want would
> be much more error prone, the small extra initial startup cost is well worth
> the reliability.
> Keeping the flag does mean we can't do destructive or intrusive operations
> on init (for example, start recording a video feed from an attached camera),
> but I would argue that init should never have those behaviors.
>
> - Alfred
>
>
> From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
> Behalf Of Sam Lantinga
> Sent: Tuesday, March 05, 2013 10:17 AM
> To: SDL Development List
> Subject: Re: [SDL] SDL 2.0 API stabilization
>
> I'm fine with removing SDL_INIT_EVERYTHING.
> On Mon, Mar 4, 2013 at 9:04 PM, Jared Maddox
> <absinthdraco at gmail.com<mailto:absinthdraco at gmail.com>> wrote:
>> Date: Sun, 03 Mar 2013 22:21:02 -0500
>> From: "Ryan C. Gordon" <icculus at icculus.org<mailto:icculus at icculus.org>>
>> To: SDL Development List
>> <sdl at lists.libsdl.org<mailto:sdl at lists.libsdl.org>>
>> Subject: Re: [SDL] SDL 2.0 API stabilization
>> Message-ID:
>> <5134131E.6060101 at icculus.org<mailto:5134131E.6060101 at icculus.org>>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> On 3/3/13 12:09 AM, Sik the hedgehog wrote:
>>> Yeah, that seems better. I realized later that SDL_INIT_TOUCH would
>>> result in programs using SDL_INIT_EVERYTHING to not get emulated touch
>>> input, but I was away by then :/ (honestly using SDL_INIT_EVERYTHING
>>> isn't a good idea in the first place, but eh)
>>
>> Actually, that's a good point: should we nuke SDL_INIT_EVERYTHING from
>> SDL 2.0?
>>
>> I mean, if we add a new subsystem, and someone has written...
>>
>>     if (SDL_Init(SDL_INIT_EVERYTHING) == -1)
>>         exit(1);
>>
>> ...then their working program might break when they don't have some
>> exotic new functionality on their platform.
>>
> We could have a function that just returns the newest value for
> SDL_INIT_EVERYTHING, but then we'd have to load SDL before SDL_Init()
> even gets called. Unless you want to separate the loading stage and
> the initialization stage, *_EVERYTHING should be either removed... or
> changed to a discrete bit flag like all of the other init flags.
>
> Probably it should just be removed.
>
>
>> Date: Sun, 03 Mar 2013 22:23:04 -0500
>> From: "Ryan C. Gordon" <icculus at icculus.org<mailto:icculus at icculus.org>>
>> To: SDL Development List
>> <sdl at lists.libsdl.org<mailto:sdl at lists.libsdl.org>>
>> Subject: Re: [SDL] SDL 2.0 API stabilization
>> Message-ID:
>> <51341398.2010406 at icculus.org<mailto:51341398.2010406 at icculus.org>>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>
>> ...while I'm thinking about it, should we roll SDL_INIT_HAPTIC and
>> SDL_INIT_GAMECONTROLLER into SDL_INIT_JOYSTICK?
>>
> Don't some mice have haptic capabilities (I half-recall magazine ads)?
> Other than that, it makes sense to me.
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org<mailto:SDL at lists.libsdl.org>
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>



More information about the SDL mailing list