I’m looking at stdint.h and given that it has uint16_t and uint_fast16_t, what is the use for uint_least16_t what might you want that couldn’t be done equally well with one of the other two?
I’m looking at stdint.h and given that it has uint16_t and uint_fast16_t, what is
Share
Say you’re working on a compiler with:
unsigned charis 8 bitsunsigned shortis 32 bitsunsigned intis 64 bitsAnd unsigned int is the ‘fastest’. On that platform:
uint16_twould not be availableuint_least16_twould be a 32 bit valueuint_fast16_twould be a 64 bit valueA bit arcane, but that’s what it’s for.
How useful they are is another story – I see the exact size variants all the time. That’s what people want. The ‘least’ and ‘fast’ versions I’ve seen used pretty close to never (it’s possible that it was only in example code – I’m really not sure).