ActiveResourceKit  v1.2 (498.0)
 All Classes Files Functions Variables Typedefs Enumerator Properties Macros Pages
Macros
ARMacros.h File Reference
#import <Foundation/Foundation.h>
Include dependency graph for ARMacros.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ARDimOf(array)   (sizeof(array)/sizeof((array)[0]))
 Answers the number of elements in the given array, the array's dimension.
 

Macro Definition Documentation

#define ARDimOf (   array)    (sizeof(array)/sizeof((array)[0]))

Answers the number of elements in the given array, the array's dimension.

Parameters
arrayA standard C array of fixed-sized elements.

Assumes that the array argument is a standard C-style array where the compiler can assess the number of elements by dividing the size of the entire array by the size of its elements; the answer always equals an integer since array size is a multiple of element size. Both measurements must be static, otherwise the compiler cannot supply a fixed integer dimension. The implementation wraps the argument in parenthesis in order to enforce the necessary operator precedence.

Note
Beware of side effects if you pass operators in the array expression. The macro argument evaluates twice.

Definition at line 40 of file ARMacros.h.