The question if these types are equivalent and which of them and when should be used is
discussed very much. But in practice you may consider them equivalent and use them as you like. Usually the type
size_t is used to emphasize that we deal with an object containing some size, number of elements or iterations. The type
uintptr_t is good for pointers.
If you do not know what type to prefer, use typedef to define your own type representing the thing you are working with.
References
- Stackoverflow.com Discussion. "size_t vs. intptr_t".
- Andrey Karpov. About size_t and ptrdiff_t.
Комментариев нет:
Отправить комментарий