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
According to the code destructor of JSONOutputArchive can be noexceptexplictly . But no matter defined CEREAL_NOEXCEPT or not according to to cppreference it's noexcept(true) implicitly.
But in fact desctructor's code is not noexcept:
//! Destructor, flushes the JSON
~JSONOutputArchive() CEREAL_NOEXCEPT
{
if (itsNodeStack.top() == NodeType::InObject)
itsWriter.EndObject();
else if (itsNodeStack.top() == NodeType::InArray)
itsWriter.EndArray();
}
Causers are rapidjson::Writer::EndObject and rapidjson::Writer::EndArray methods that may throw exceptions. For example at the moment when destructor is called stream(nested to writer) to write in can be closed or in invalid state(e.g. zero space on disk if using filestream). And in particular cases it can lead to exception throwing.
This defect makes JSONOutputArchive unsafe to use if system can be heavy loaded(e.g. highloaded servers) because user's code(my) looses opportunity to handle such situations.
The text was updated successfully, but these errors were encountered:
Poshjark
changed the title
JSONOutputArchive destructor is not really noexcept(true) though it's declared noexcept(true)
JSONOutputArchive destructor is not really noexcept(true) despite it's declared noexcept(true)
May 20, 2024
According to the code destructor of
JSONOutputArchive
can benoexcept
explictly . But no matter definedCEREAL_NOEXCEPT
or not according to to cppreference it'snoexcept(true)
implicitly.But in fact desctructor's code is not noexcept:
Causers are
rapidjson::Writer::EndObject
andrapidjson::Writer::EndArray
methods that may throw exceptions. For example at the moment when destructor is called stream(nested to writer) to write in can be closed or in invalid state(e.g. zero space on disk if using filestream). And in particular cases it can lead to exception throwing.This defect makes JSONOutputArchive unsafe to use if system can be heavy loaded(e.g. highloaded servers) because user's code(my) looses opportunity to handle such situations.
The text was updated successfully, but these errors were encountered: