can anyone tell me why would someone use the uint8_t function in their program
admin's test signature
Same as unsigned char..... if its just a boolean or a small integer, signed and unsigned generate about the same code, but in a loop testing a signed int for twos complement >= <= conditions sometimes takes two instructions... test the equal to zero bit, test the overflow bit.... so unsigned char is good for lean and mean code when you know it never goes negative....
Also, uint8_t is fairly standard across platforms. When you use that define, you are guaranteed that it is an 8-bit unsigned type.
You can also ask this on the GCC forum (where you're more likely to encounter it).
Bob's right, and of course it's a *lot* quicker typing uint8_t (and uint16_t, etc) than "unsigned char" (or "unsigned short", etc). :)
The C language doesn't say too much about the actual size of the data types (within certain constraints), it's left to the compiler writer to choose the best size for his/her particular target.
When writing microcontroller code we so often care very much about the true size of the variables (for bit-manipulating, etc) so in many ways these typedefs are preferable.
I think you win the prise for thread necromancy. A thread so old, none of the the member accounts which started it or contributed to it exist any more, and the posts have been assigned to the 'admin' place-holder account.
Eleven years, ten months, and thirteen days. Four thousand, three hundred, and thirty-five days.
Yup. Definitely a winner!
EDIT: and now I see it's just one of 5 recent SPAM posts!!!
I would stop
"Experience is what enables you to recognise a mistake the second time you make it."
"Good judgement comes from experience. Experience comes from bad judgement."
"Wisdom is always wont to arrive late, and to be a little approximate on first possession."
"When you hear hoofbeats, think horses, not unicorns."
"Fast. Cheap. Good. Pick two."
"We see a lot of arses on handlebars around here." - [J Ekdahl]
© 2020 Microchip Technology Inc.