I am working on a small network application that uses byte arrays. Traditionally, they will be announced with something like char buf[] = ...
.
It seems that this (still?) Has been done in most textbooks, but it has a problem that it can obscure what is actually happening, for example, when you try to print such an array and forget that not every char is a visible character .
Some people suggested that you should completely stop using it chars
and use a modern one instead uint8_t
. I find it very attractive, mainly on the principle that explicit is better than implicit.
So, is there something wrong with declaring these array types as uint8_t buf[] = ...
?
source
share