Projects > cpp > Issues > Refactor #879

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

use CCAssert() instead of assert()

Refactor #879 [Closed]
dumganhar 2011-11-27 22:14 . Updated over 4 years ago

There are a lot of ‘assert()’ in cocos2d-x project. Because the bada platform doesn’t have system assert support and cocos2d-x owns the macro ‘CC_ASSERT’.

// assertion
#include 
#define CC_ASSERT(cond)                assert(cond)

#include "CCPlatformFunc_bada.h"
#ifdef _DEBUG
#define CC_ASSERT(cond)  (void)( (!!(cond)) || (badaAssert(__PRETTY_FUNCTION__ , __LINE__ , #cond))
#else
#define CC_ASSERT(cond)  void(0)
#endif /* _DEBUG */
#endif

badaAssert function use the bada system messagebox to notify programmer that there is an assert appeared. If use assert directly, there are no assert notifications.

zhangxm 2011-11-28 18:14
  • Subject changed from use CC_ASSERT() instead of assert() to use CCAssert() instead of assert()
zhangxm 2011-11-29 18:23
  • Status changed from New to Resolved
zhangxm 2011-11-29 18:23
  • Status changed from Resolved to Closed
walzer@cocos2d-x.org 2012-05-25 08:03
  • Project changed from cocos2d-x to cpp
  • Category deleted (5)
  • Target version deleted (cocos2d-1.0.1-x-0.10.0)

Atom PDF

Status:Closed
Start date:2011-11-27
Priority:Normal
Due date:
Assignee:zhangxm
% Done:

0%

Category:-
Target version:-

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.