Use clear Stack

Source: Internet
Author: User

· To push objects into the cleanup stack, you can
-Use cleanupstack: pushl (PTR) for pointers ---- the memory will be deleted when an exception exits.
-Use cleanupclosepushl (handle) for the handle ---- the handle is closed when an exception exits.

· To clear the stack from the pop-up object, you can
-Use cleanupstack: Pop (pointer) to pop up the top object of the stack.
-Use cleanupstack: popanddestroy (pointer) to pop up and delete/close objects.

· Features of objects that need to be pushed into the cleanup Stack
-This object is referenced by a local pointer.
-During the lifetime of the object, a function that may exit abnormally is called.

· Do not push member variables of the class into the cleanup Stack

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.