uint8_t, uint16_t, int, unsigned int


I am trying to modify a library at the moment. The library uses:

uint8_t and uint16_t

Until now I am only used of using the int and unsigned int (data types as described in the arduino reference).

Why should you use uint8_t and uint16_t instead of int unsigned int? is it good practice?

Thanks in advance.

This should explain everything. http://en.wikipedia.org/wiki/Stdint.h

As it says, using those methods make your code more portable because it can be reused on other platforms because they might have a different idea of what int and others mean.

Using the Stdint types does help to make code portable and it is good practice for writing libraries.

But I suggest you stick to the arduino documented types for sketch code. Almost all the Arduino abstractions that are designed to make code easier to read and write are not portable to other platforms and using the more esoteric Stdint types would only serve to confuse many beginners.