Twenty-two military rules for Symbian memory management

xiaoxiao2021-03-06  43

The twenty-two military regulations / peter jiang1, Class C, which symbian memory management, must have a destructive function, which is a virtual function of CBase. 2, the Class C constructor and constructL () must be a member function of the Protect or Private type, and there must be a newlc () function in the C class unless it is a nested class. NEWL () is optional and is always implemented according to NEWLC (). 4, newl () and newlc () must be a Static function in Class Class. 5, Class C pass through pointers and references. 6. The copy constructor is useless in Symbian. 7. Do not have to delete a member object of the class in the destructor. (The end of the life is deleted) 8. The object must be checked in the destructor. That is, IObject delete IObject; IObject = NULL; (personal preference) 9, the R class does not have a clear constructor, destructor or copy constructor, and assignment operation. 10, delete a; a = null; a = b; standard redistribution process. 11. Any function that can lead to an abnormally exit is a suffix. 12. Do not delete non-owned objects (i.e., those only use only objects) 13, define a suitable particle size before allocating a dynamic array. 14. Replace the New to New (Eleave) .15, IF (function cannot abnormally exit && want to handle errors) Use Trap && not too much nested. 16, IF (AOBJECT is referenced by an automatic variable pointer && will perform a possible operation in the AOBJECT survival period) Cleanupstack :: Pushl (AObject); 17, can never put a member variable of a prefix into the stack. 18, the constructor can not Leave, put the statements that may be abnormally exited into constructl (). 19, Symbian's default stack capacity is 8K, carefully use recursive. 20, the length of TBUF is preferably not over 16, if necessary, use HBUFC instead of TBUF.21, using __uheap_maek macro to detect your memory status. 22. To remove everything you lose use, don't wait until the end (auto variable) or delete (member variable) in the destructor.

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

New Post(0)