--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
so, let me only address the first bullet here, by using a simpler example:
T& optional<T>::operator*()
precondition{ is_initialized(*this) };
T& optional<T>::operator=(T&&)
postcondition{ is_initialized(*this) };
And imagine that for some reason is_initialized cannot be formed/define. This is_initialized would be used by static analyser not as a function, which can be evaluated, but as a "tag" or a "label". Objects at certain points in time acquire the label, keep it for certain time, and then, they can loose it as an effect of a mutable operation.
void fun( optional<T> & o )
{
// property is_initialized(o) cannot be determined
o = T{1};
// is_initialized(o) holds, even though we do not know what it means
*o; // precondition is met
mutable_fun(o);
// property is_initialized(o) cann no longer be determined to hold
}
Regards,
&rzej
Compilers are not going to be able to always prove that functions
preconditions are satisfied. Indeed, I expect some preconditions
would be hard to specify in code, and so would be out of reach of
any automation. So, I don't know what we could normatively say
about static checking of interfaces.