Use C ++ instead of C (2) to use assertion

xiaoxiao2021-03-06  14

Using an assertion 12. Select an ASSERT macro when using the MFC 13. Do not use the Verify macro, use the assertion macro 14. You must call an Assert_Valid macro 15 before using the COBJECT class. Always call the assert_valid macro before calling Assert_kindof 16. Transplantation When the code is also transplanted. 17. To take advantage of the assertion to take a certain policy, don't pay freely to distribute the assertions into your code, but comply with some models that have been established 18. "Assert the word", is Say: Don't try to choose which assertion to discover errors, but as if you assert all 19. The most powerful assertion is used to verify the fixed relationship between the variables. These relationships are called invariant relationships. Among them, the constant relationship and cyclic constant relationship is the most commonly 20. Design procedure is designed to design constant relationships, understand them before writing code, and establish documentation for them 21. Public member function is more than private and protected member functions 22. the full realization of a comprehensive assertion AssertValid function, do not use the default MFC ClassWizard provide recommendations for implementation 23. AssertValid function uses the following assertion mode: void CMyObject :: AssertValid () {// check the immediate base class first CMyObjectBaseClass :: AssertValid (); // check the data members not in the base class assert_valid (m_pobject1); assert_valid (m_pobject2);

转载请注明原文地址:https://www.9cbs.com/read-47229.html

New Post(0)