Open
Description
sfSound* sfSound_create(const sfSoundBuffer* buffer)
{
assert(buffer);
return new 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.