Problematic int8 type defined in JUCE

the int8 type in JUCE is defined as

typedef char int8;

somehow I got the same definition in another file, but it was

typedef unsigned char int8;

To fix the problem I had to patch JUCE, as I feel that my version is safer (it might be that “char” can be unsigned by default).

Actually to prevent such problems (of overdefining), I’ve put a little scheme which goes like this:

typedef unsigned char int8;

If that was done also on the JUCE side, then the re-definition would be skipped. (Although that’s not really safe solution, as it depends on how the include files are included, and would stop the compiler from reporting the bug as seen, instead once treating int8 as char, and the other time as unsigned char).

Also it’s really C++ issue, as there is mangling difference between signed char and just char.

i would think uint8 would be unsigned and int8 would be signed. juce’s definition is the more accurate one, i think.

all the compilers that I’ve targeted assume that char is signed, so as long as int8 is a signed 8-bit value you’d be ok.

The code you’ve put here could make things go subtly wrong because it’s defining it as unsigned… (not that I ever make much use of the int8 type)

I’m sorry I mean int8 as signed char, not unsigned. Silly me