1 practical example of typedef
is size_t
. It is guaranteed to be big enough to contain the size of the biggest object the host system can handle. The maximum permissible size is dependent on the compiler; if the compiler is 32 bits then it is simply a typedef
for unsigned int
but if the compiler is 64 bits then it would be a typedef
for unsigned long long
. The size_t
data type is never negative.
↧
Answer by Rana Vivek for When should I use typedef in C++?
↧