Are the types size_t and uintptr_t equivalent?

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



Use PVS-Studio to search for bugs in C, C++, C# and Java

We offer you to check your project code with PVS-Studio. Just one bug found in the project will show you the benefits of the static code analysis methodology better than a dozen of the articles.

goto PVS-Studio;



Bugs Found

Checked Projects
409
Collected Errors
14 072
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site. Learn More →
Accept