c++ Programming Glossary: contract
How to change the constness of a variable in C++? http://stackoverflow.com/questions/13618706/how-to-change-the-constness-of-a-variable-in-c By attempting to change the constness you break the contract with the compiler. If you need to modify a variable simply do.. code. Note that the compiler does so because you made an contract with the compiler Heres my i and it will never be changed throughout..
C++ interview - testing potential candidates http://stackoverflow.com/questions/1398436/c-interview-testing-potential-candidates to review. For example the first would be about design by contract see if they know what preconditions postconditions and invariants..
Does const mean thread-safe in C++11? http://stackoverflow.com/questions/14127379/does-const-mean-thread-safe-in-c11 of view. It is important to note that this is merely a contract and it won't be enforced by the compiler if you break it you.. container directly or indirectly we are entering a contract with the Standard Library . To keep doing writes in a const.. doing writes in a const function while still honoring that contract we need to internally synchronize those writes class rect int..
How to break out of a loop from inside a switch? http://stackoverflow.com/questions/1420029/how-to-break-out-of-a-loop-from-inside-a-switch while true loop is poor form because it Breaks the implied contract of a while loop. The while loop declaration should explicitly..
How to create a boost ssl iostream? http://stackoverflow.com/questions/3668128/how-to-create-a-boost-ssl-iostream your own class that implements the appropriate Device contract. In this case that's Sink and the boost iostreams sink class..
What is wrong with making a unit test a friend of the class it is testing? http://stackoverflow.com/questions/4171310/what-is-wrong-with-making-a-unit-test-a-friend-of-the-class-it-is-testing indicates that your test cases don't fully reflect the contract you wish your class to implement. The solution to this problem..
Are assertions always bad? http://stackoverflow.com/questions/419406/are-assertions-always-bad of assert as per JaredPar's comment that acts like a contract. This version is compiled into the release code so there is..
How to throw good exceptions? http://stackoverflow.com/questions/556255/how-to-throw-good-exceptions thrown in destructors i'll add that i understand design by contract and when to throw exception. I am asking how i should throw.. if it can't keep its promise if it has to break its contract . The function's signature name and parameters determine its.. The function's signature name and parameters determine its contract. Given these two member functions const Apple FindApple const..
Can a local variable's memory be accessed outside its scope? http://stackoverflow.com/questions/6441218/can-a-local-variables-memory-be-accessed-outside-its-scope is not required to remove your book. You didn't make a contract with them that said that if you leave stuff behind they'll shred.. not required to catch you sneaking in. You didn't make a contract with them that said if I try to sneak back into my room later.. later you are required to stop me. Rather you signed a contract with them that said I promise not to sneak back into my room..
Subclass/inherit standard containers? http://stackoverflow.com/questions/6806173/subclass-inherit-standard-containers you are tying that extended behavior to your interface contract in a way that ties users hands to future changes. For instance..
C++: When to use References vs. Pointers http://stackoverflow.com/questions/7058339/c-when-to-use-references-vs-pointers argument and it is fine for the function. That's kind of a contract between the user and the implementation. share improve this..
|