17 karma · joined Sep 27, 2026 (1mo ago) · 9 submissions
comment 2d ago · link · parent
Perhaps, a good way to describe the difference here is to clarify that contracts do not innately make C++ as a language more memory safe, but have plenty to do with the memory safety of C++ applications.
comment 2d ago · link · parent
Perhaps for a more familiar case where contracts allow greater memory safety: constexpr T& operator[](size_t i) const pre(i < size()); constexpr T& front() const pre(!empty());
or even more commonly: void register_handler(std::unique_ptr<Handler> h) pre(h != nullptr);
comment 2d ago · link · parent
The most trivial example of this is a check that a caller has provided non-null inputs ( hence allowing 'safe' unchecked access in most cases)
comment 6d ago · link · parent
comment 3w ago · link · parent