cout versus SDL_Log() for error messages

I have noticed that SDL_Log() always prints before cout even if it is called after cout, what are the implications of using cout instead of SDL_Log()? I am looking for runtime debugging.

Are you flushing std::cout using std::flush or std::endl?

Hello Peter. I leave the end floating, as in, std::cout << “Example message\n” ; I am not flushing.

I’m unable to test this at the moment but my thought is that maybe if you don’t flush std::cout it will not write the output until later, which might be after later output written by SDL_Log.

When using the standard streams we normally don’t run into problems because the standard C++ streams (std::cout, std::cerr and std::cin) are “tied” which means that they will automatically flush each other and mixing them with the C streams (and std::clog) are also not a problem unless std::ios::sync_with_stdio(false) is used but maybe SDL_Log works differently, I don’t know…