SDL2-2.0.3 SDL_Init(flags)

Started by
2 comments, last by Jan2go 9 years, 3 months ago

Is there any loss - perhaps, backwards compatibility - in calling SDL_InitSubSystem(flags) in place of SDL_Init(flags) since SDL_Init just calls SDL_InitSubSystem in a return statement?

From SDL2-2.0.3/src/SDL.c

int

SDL_Init(Uint32 flags)

{

return SDL_InitSubSystem(flags);

}

I've already made this switch in my code and have run into no problems. Just double checking.

"You all look like lions to me. Lets be rabbits again."

Request for Comments => https://github.com/ts-williams

Advertisement

From the SDL wiki:

If you want to initialize subsystems separately you would call SDL_Init(0) followed by SDL_InitSubSystem() with the desired subsystem flag.

So you should be save if you call SDL_Init(0) somewhere at the beginning of your program.

Thanks for the info. Not seeing any immediate ill effects from simply replacing SDL_Init with SDL_InitSubSystem, I didn't look any further/ I didn't comb through SDL_InitSubSystem, but I will now just to be safe. If I find the reason for calling SDL_Init(0) first, I'll give the details here.

"You all look like lions to me. Lets be rabbits again."

Request for Comments => https://github.com/ts-williams

Well, currently there is no reason for calling SDL_Init() before calling SDL_InitSubSystem(), no matter what flags you use. This is because the current implementation of SDL_Init() is as follows:

int
SDL_Init(Uint32 flags)
{
    return SDL_InitSubSystem(flags);
}

However that might change at some time in the future, so I'd recommand sticking to the SDL_Init(0) call just in case you want to update your SDL version and they really changed something in regard to this.

This topic is closed to new replies.

Advertisement