Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You add something like:

  DCHECK(myInvariants());
to your method bodies. Sure, it makes it possible to forget, but it's not that hard to use.


A big part of DbC is that contracts are part of the public interface, not the implementation. This becomes especially important once you mesh them with Simula-style OOP, as derived classes need a way for overridden methods to widen or narrow the inherited contract.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: