Why does the statement const int8_t* cstr = "asdf"; gives error
invalid conversion from ‘const char*’ to ‘const int8_t*’
Aren't int8_t* and char* same?
Am I missing some subtle thing here?!
const signed char* is not the same as const char*. Check your compilation settings, because that would explain it. int8_t is always (never say never =) at least everywhere i've seen) defined as signed char.
According to [18.4 Integer types]:
typedef signed integer type int8_t; // optional
And [3.9.1 Fundamental types]:
Plain char, signed char, and unsigned char are three distinct types
int8_t is a signed integer type (on my system defined as signed char) and char and signed char are distinct types, so they are different.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With