.
, . UpdatingSystem.
:
{
UpdatingSystem tempUnsafe("Reason it unsafe");
unsafe_operation(tempUnsafe);
safe_operation();
another_unsafe_operation(tempUnsafe, 42);
}
, UpdatingSystem.
Updating unsafe features is easy, just pass the link. You do not even need to do anything with the object or copy it.
another_unsafe_operation(UpdatingSystem const & lock, int data)
{
}
This approach, as a rule, makes life easier for programmers, because this is the only way to get them to properly handle unsafe functions.
If it is “impossible” to define security at the function level this way, you may need to rethink the abstractions of your program.
source
share