I'm an electrical engineer turned to computer scientist. It's really hard for me to understand why in C++ there are so many things that are almost the same but not completely the same. An example is short
vs int
vs unsigned int
vs size_t
vs long int
vs long long int
vs uint8_t
(I don't know if there is any additional way to designate an integer). It seems that it makes the language unnecessarily complicated.
Could or should size_t
be replaced or does it have any feature impossible to use in another way?
[EDIT]
After the helpful answers, there is something that I still don't fully see. size_t
is useful in terms of portability and performance as several persons suggested. But how helpful, is there a quantitative way or numerical evidence to measure the advantages over having just only int
and retire all its brothers???