FYI, char in C++ (VS Code) is unsigned

I just spent 2 days trying to figure out a bug in C++ firmware code I had written. As it turns out, the bug was being caused by my rather rash assumption that char is signed as it is in GNU C++ under Linux (vs. unsigned char). But with this VS Code compiler and ProjectIO extension I’m using, it turns out char is unsigned; if you want a signed char, you need to use the signed char type.

Perhaps a flag like gcc’s -funsigned-char is set in the firmware’s build environment?

Just beware of this.

1 Like