1650Fermer1652
FarewellLe 29/05/2010 à 13:15
    catch (char* errorStr)
    {
        SDL_FreeSurface (m_Background);
        while (m_IconList.size () != 0)
        {
            delete m_IconList.back ();
            m_IconList.pop_back ();
        }
        throw (errorStr);
    }
    catch (std::bad_alloc)
    {
        SDL_FreeSurface (m_Background);
        while (m_IconList.size () != 0)
        {
            delete m_IconList.back ();
            m_IconList.pop_back ();
        }
        throw ((char*) "Out of memory\n");
    }

Savez-vous s'il y a un moyen d'éviter la duplication de code dans un handler d'exception ? Je n'ai pas trouvé dans mon bouquin...