I can't understand the C++ spec. It seems more vague than the old K&R.
If the source is a signed integral type and the destination is an
unsigned integral type that is larger, are the additional bits done
via sign extension or zero extension?
e.g.
int i;
unsigned long l = i;
Is i sign extended from int to long and then converted to unsigned
long or is it converted to unsigned int and then zero extended to
unsigned long?
(assume that long is bigger in this case). I'm actually going from a
long to an unsigned long long but I assume the same algorithm is used.
I guess, to be safe, I could do:
unsigned long l = static_cast<unsigned int>(i);
Thank you,
Perry