diff --git a/cocos2dx/cocoa/CCArray.h b/cocos2dx/cocoa/CCArray.h index 827bbda49c..1f68f08351 100644 --- a/cocos2dx/cocoa/CCArray.h +++ b/cocos2dx/cocoa/CCArray.h @@ -48,25 +48,25 @@ __arr__++) I found that it's not work in C++. So it keep what it's look like in version 1.0.0-rc3. ---By Bin */ -#define CCARRAY_FOREACH(__array__, __object__) \ - if ((__array__) && (__array__)->data->num > 0) \ - for(CCObject** arr = (__array__)->data->arr, **end = (__array__)->data->arr + (__array__)->data->num-1; \ - arr <= end && (((__object__) = *arr) != NULL/* || true*/); \ - arr++) +#define CCARRAY_FOREACH(__array__, __object__) \ + if ((__array__) && (__array__)->data->num > 0) \ + for(CCObject** __arr__ = (__array__)->data->arr, **__end__ = (__array__)->data->arr + (__array__)->data->num-1; \ + __arr__ <= __end__ && (((__object__) = *__arr__) != NULL/* || true*/); \ + __arr__++) -#define CCARRAY_FOREACH_REVERSE(__array__, __object__) \ - if ((__array__) && (__array__)->data->num > 0) \ - for(CCObject** arr = (__array__)->data->arr + (__array__)->data->num-1, **end = (__array__)->data->arr; \ - arr >= end && (((__object__) = *arr) != NULL/* || true*/); \ - arr--) +#define CCARRAY_FOREACH_REVERSE(__array__, __object__) \ + if ((__array__) && (__array__)->data->num > 0) \ + for(CCObject** __arr__ = (__array__)->data->arr + (__array__)->data->num-1, **__end__ = (__array__)->data->arr; \ + __arr__ >= __end__ && (((__object__) = *__arr__) != NULL/* || true*/); \ + __arr__--) #if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) -#define CCARRAY_VERIFY_TYPE(__array__, __type__) \ - do { \ - if ((__array__) && (__array__)->data->num > 0) \ - for(CCObject** arr = (__array__)->data->arr, \ - **end = (__array__)->data->arr + (__array__)->data->num-1; arr <= end; arr++) \ - CCAssert(dynamic_cast<__type__>(*arr), "element type is wrong!"); \ +#define CCARRAY_VERIFY_TYPE(__array__, __type__) \ + do { \ + if ((__array__) && (__array__)->data->num > 0) \ + for(CCObject** __arr__ = (__array__)->data->arr, \ + **__end__ = (__array__)->data->arr + (__array__)->data->num-1; __arr__ <= __end__; __arr__++) \ + CCAssert(dynamic_cast<__type__>(*__arr__), "element type is wrong!"); \ } while(false) #else #define CCARRAY_VERIFY_TYPE(__array__, __type__) void(0)