You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sfSound* sfSound_create(const sfSoundBuffer* buffer)
{
assert(buffer);
returnnew sfSound{sf::Sound(buffer->This), buffer};
// what would happen if new throws?
}
best to replace it with new(std::nothrow) which returns null on allocation failure. the copy can still fail and throw an exception!
C doesn't have exceptions and in general we should catch exceptions and translate them to error codes or let nothrow new do that for us.