[webkit-dev] Should LChar really being unsigned char? (was Re: SerializedScriptValue: signed vs unsigned char)

Darin Adler darin at apple.com
Sun Feb 10 10:38:15 PST 2013


Short answer, yes.

On Feb 10, 2013, at 9:14 AM, Glenn Adams <glenn at skynav.com> wrote:

> Because LChar is often (always?) UTF-8 encoded, the individual encoding units of which are 0x00 through 0xFF.

Close.

LChar is always Latin-1 encoded. That’s what the "L" is for. That’s the same thing as the first 256 code points in Unicode.

If LChar could possibly be a signed byte, then we’d have to cast to an unsigned byte at every call site where we are storing an LChar in a UChar; very easy to get that wrong. Since LChar is an unsigned type we can simply do a normal assignment and we get correct behavior.

-- Darin


More information about the webkit-dev mailing list