Go to the source code of this file.
|
#define | ctb_arr(itemType, length) |
| Creates an array of the given type and length.
|
|
#define | ctb_obj(type) |
| Creates an object of the given type and initializes it with zeros.
|
|
#define | ctb_lengthOf(arr) |
| Calculates the length of the given array.
|
|
#define | ctb_containerOf(obj, type, member) |
| Calculates the address of the containing object.
|
|
#define | ctb_staticAssert(expression, identifier) |
| Generates a compile-time assertion.
|
|
◆ ctb_arr
#define ctb_arr |
( |
| itemType, |
|
|
| length ) |
Value: ((itemType[length]){ 0 })
Creates an array of the given type and length.
- Parameters
-
itemType | Type of each item in the array |
length | Number of items in the array |
◆ ctb_containerOf
#define ctb_containerOf |
( |
| obj, |
|
|
| type, |
|
|
| member ) |
Value: ((type *)((char *)(obj) - offsetof(type, member)))
Calculates the address of the containing object.
- Parameters
-
obj | Object to calculate the containing object from |
type | Type of the containing object |
member | Member of the containing object |
◆ ctb_lengthOf
#define ctb_lengthOf |
( |
| arr | ) |
|
Value: (sizeof(arr) / sizeof(arr[0]))
Calculates the length of the given array.
- Parameters
-
arr | Array to calculate the length from |
◆ ctb_obj
Value:
Creates an object of the given type and initializes it with zeros.
- Parameters
-
◆ ctb_staticAssert
#define ctb_staticAssert |
( |
| expression, |
|
|
| identifier ) |
Value: typedef char identifier[(!!(expression)) * 2 - 1]
Generates a compile-time assertion.
- Parameters
-
expression | Expression to assert |
identifier | Identifier to use in the assertion |