Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<cstdint> vs std::size_t types

Tags:

c++

c++11

stl

From the peeks I've made into boost and libstdc++, the libraries usually make use of std::size_t and std::ssize_t whenever the upper/lower limit of an unsigned/signed index is not known in advance. My question is: Why not rather use uintmax_t from <cstdint> instead of std::size_t and intmax_t instead of std::ssize_t?

like image 954
user1095108 Avatar asked Mar 20 '23 15:03

user1095108


1 Answers

The former are part of the C++ standard, the latter are not. More precisely, the cstdint header was only recently introduced (in C++11). The reason for this is that stdint.h itself is part of C99, which is newer than C++98.

like image 84
ypnos Avatar answered Mar 22 '23 05:03

ypnos