Encoding 3 bytes to 4

Got this example from Adafruit , and it was OK before :

void loop()
char x=“Man”;
char y;


char base64set=“ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/”
“ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=” ;

// repeating the base64 characters in the index array avoids the 077 & operations

char* Byte3toChar4(unsigned char ra[3]){
static char ar[4] = { base64set[ ra[0] >> 2 ] ,
base64set[ ra[0] << 4 | ra[1] >> 4 ] ,
base64set[ ra[1] << 2 | ra[2] >> 6 ] ,
base64set[ ra[2] ] };
Serial.println("Returns: ");
return (char *(ar));

Now I have installed the latest version of, the IDE , 1.8.2 , and it does not work anymore
Why ?

Error message = invalid conversion from ‘char*’ to ‘unsigned char*’ [-fpermissive]

42 posts and never used code tags?

Also, not the complete error (or code) which makes it harder to find. But why does you function use unsigned char while your sketch uses char? And I’m not sure, but maybe the default of a char was unsigned in the past.

And really base64set not in progmem an repeated 4 times :o

OK , thanks for quick answer and you have some good points ... but now I have discovered
the answer , so to speak , but ending up with another puzzle , but more puzzling...:

It was not so much having updated the IDE that made the difference , but having meantime switched
board , from Uno to M0 that caused the problem ... switching back to Uno , it was OK again ...

ut THAT is a bit more curious ... the C++ used should obey to the same rules , no matter which board
selected , no ?

Is a char the same size on those two boards?

Unfortunately not... Not all variable types are very strict defined. A char is "Smallest addressable unit of the machine that can contain basic character set.". So that may change depending on the architecture. And you did not define the sign, which leaves it to the compiler. The AVR compiler defaults to signed for most (all?) types but others may default to unsigned etc.

OK , thanks for that , will make a new try then :slight_smile: