Auxiliary macros related to cocos2dx

Source: Internet
Author: User

The reference count is clever and convenient, but most of the processing processes involve pointers, which are cumbersome and error-prone. To address this problem, Cocos2d-x is accurate for us

A series of auxiliary macros are provided to simplify the Code. These macros are included in the header file "ccplatform Macro. H. Table 2-2 lists the macros related to memory management. ? Table 2-2 memory management-related macros in the Cocos2d-x

? Macro

? Description

? Cc_safe_delete (P)

? Use the delete operator to delete a C ++ object P ,? If P is null, no operation is performed.

? Cc_safe_delete_array (P)

? Use the Delete [] operator to delete a C ++ array P ,? If P is null, no operation is performed.

? Cc_safe_free (P)

? Use the free () function to delete p. If P is null ,? No operation

? Cc_safe_release (P)

? Use the release () method to release the Cocos2d-x object P

32

Cocos2d-x advanced development tutorial

? If P is null, no operation is performed.

? Cc_safe_release_null (P)

? Use the release () method to release the Cocos2d-x object P? For a single reference, P is assigned null. If P already exists
? If it is null, no operation is performed.

? Cc_safe_retain (P)

? Use the reatin () method to add one of the Cocos2d-x object P? . If P is null, no operation is performed.

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.