What is the differnce between UInt8
and uint8_t
, or UInt16
and unit16_t
?
What does the _t
imply?
In C99 the available basic integer types (the ones without _t) were deemed insufficient, because their actual sizes may vary across different systems.
So, the C99 standard includes definitions of several new integer types to enhance the portability of programs. The new types are especially useful in embedded environments.
All of the new types are suffixed with a _t and are guaranteed to be defined uniformly across all systems.
For more info see the fixed-width integer types section of the wikipedia article on Stdint.
The main difference is that the uintX_t
types are standard C defined by C99 and later while UIntX
is not. This has implications for how portable the code is. Code using uintX_t
types can be compiled on any standard C compiler without any other dependencies. Code that uses UIntX
on the other hand, must either define those types itself, or depend on some library or framework that does so.
I don't think Objective-C as such defines any extra integer types, but it may well be that your framework (Coacoa, OpenStep?) does so. If your code makes no sense outside of the framework, use what's idiomatic in the framework context. Otherwise try to stick to the standard types.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With