Similar to P99_GENERIC but the choice is not done according to the type of the expression UI but for its unsigned value.
- Parameters:
-
| UI | must be a compile time integer expression that is cast to size_t and that must not be of value 0. |
a = P99_GENERIC_SIZE(sizeof(a),
func_fallback,
(1, func1),
(2, func2),
(4, func4),
(8, func8))
((void*)&a);
In this example one of the functions func1, ..., func8 is chosen according to the size of a. This function is then called with the address of a. In case that the size of a is not appropriate a function func_fallback is used.
- Warning:
- The range of allowed values for UI is platform dependent. The only known fixed guarantee is
UINT16_MAX, but the result of a sizeof operator should always work.
- See also:
- P99_GENERIC
Definition at line 496 of file p99_generic.h.