GCC Warning: array subscript has type 'char'


#1

In a piece of inherited code, there’s a place where an array index is explicitly cast to char; eg,

my_value = my_array[ (char)my_index ];

So there’s no disputing that the array subscript does, indeed, have type ‘char’!

But why does GCC think that it’s necessary to warn about this?
Is it because plain ‘char’ is (or could be) signed…?

I don’t have the original toolchain, so I don’t know what (if anything) it said about this…

It’s not an issue - I’m just curious!

:confused: