[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: char vs. unsigned char
From: |
David Chisnall |
Subject: |
Re: char vs. unsigned char |
Date: |
Fri, 13 Mar 2015 10:05:13 +0200 |
On 12 Mar 2015, at 21:11, Riccardo Mottola <address@hidden> wrote:
>
> I wonder why these were declared as unsigned as first.
It's convention in some codebases to use 'unsigned char' to mean 'char sized
data'. uint8_t is generally better for this, as it explicitly states that it's
8-bit integer values and not things that might be interpreted as characters.
The C spec regards char, signed char, and unsigned char as distinct types, but
requires that char have the same range as either signed char or unsigned char.
For data buffers, void* may be what you actually want.
David