This is in reference to this question
How to implement the c malloc/realloc functions properly?
where the accepted answer mentions that a
A char array that doesn't have allocated storage duration can only be
aliased by a character type. In other words it cannot and it should
not be used as arbitrary memory
I believe the issue he pointed out was that if you allocate a
char type array statically and then compile your library with a modern, desktop-like C compiler like gcc, you cannot easily convert the contents of that area to another type. Because then the compiler would perform optimizations based on pointer aliasing and screw everything up, see "the strict aliasing rule".
Simply assure that your compiler does not use strict aliasing and you'll be fine. For example, none of the common embedded systems compilers on the market does this.
With gcc you'd compile as
-fno-strict-aliasing. Might be good to always enable warnings for code that would cause such problems
As a side note,
uint8_t makes far more sense to use as generic type, because unlike
char, it is completely unambiguous: it has no signedness and the size is well-known.