K
Ken Tough
Seems like a simple thing to find out, but I'm struggling. I have
googled, but everything I find is about implicit conversion,
not explicit.
Is this implementation-specific, or does ANSI/ISO lay out what
should happen for:
--------------------------
signed char sc;
unsigned char uc;
uc = 0xFF;
sc = (signed char)uc;
[what value is now in sc? Will it always be -1? What about
non-two's complement representations, etc. I need to know
that coding is not implementation-specific.]
--------------------------
And similarly the case for
sc = -100;
uc = (unsigned char sc);
[what value is guaranteed to be uc?]
googled, but everything I find is about implicit conversion,
not explicit.
Is this implementation-specific, or does ANSI/ISO lay out what
should happen for:
--------------------------
signed char sc;
unsigned char uc;
uc = 0xFF;
sc = (signed char)uc;
[what value is now in sc? Will it always be -1? What about
non-two's complement representations, etc. I need to know
that coding is not implementation-specific.]
--------------------------
And similarly the case for
sc = -100;
uc = (unsigned char sc);
[what value is guaranteed to be uc?]