I'm confused about the rules concerning this matter [a good URL might save time in answering]. I notice that a lot of the time conversion implicitly works but other times it's required.
e.g. I had expected it to work:
long long a;
int b;
[..]
a = b * 1000;
but it turns out, 'a' overflows and it's required to
a = (long long) b * 1000;
That was peculiar since 'a' being the 'big one' I had expected it would bother.
Anyway, apart from that example, do you know a comprehensive source of information on the matter? No 'most of the time is ok', that gets me paranoid.
EDIT: Is it only a matter of 'the second part does the calculation first and there it overflows, follow that rule closely'?
EDIT2: If there is a calculation such as
long long a;
int b;
short c;
[..]
c = b + a * 3;
, would doing
c = b + (int) a * 3;
ensure proper conversion?
or would it need
c = (short) b + (int) a * 3;
or, would it be enough to
c = (short) b + a * 3;