The 'rsize_t' is an unsigned integer type and is very similar to the type size_t.

The 'size_t' type is a result of the 'sizeof' operator. Variables of the 'size_t' type are guaranteed to have enough capacity to store the size of any object or array of objects. The largest value such a variable can store is SIZE_MAX. The 'size_t' type can also be used to store an address.

The 'rsize_t' type is a synonym of 'size_t' but it is designed to store the size of a single object. In other words, by using the 'rsize_t' type the programmer emphasizes that he is handling the size of one single object. Its maximum size is specified by the RSIZE_MAX constant.

The RSIZE_MAX constant can also be used to check the values of the arguments passed into a function: if a function receives an object size as one of the arguments, this value cannot be larger than RSIZE_MAX.


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++ and C#

goto PVS-Studio;