What goes where?
18-Feb-88 11:10:53
Sb: #109715-What goes where?
Fm: Richard Rae/SYSOP 76703,4253
To: John Draper 76703,4322
This message turned up in search, but its forum couldn’t be identified from the original transcript, so it may not be linked into its thread.
<Sigh> I would THINK that "always explicitly cast" implies that it's done
WHEN THE DATA TYPES ARE DIFFERENT.
In my estimation,
int a,b,r;
long int c;
r=(int)a+(int)b;
is just as incorrect as (given the above declarations)
r=b+c;
In the latter case, you have not performed a needed cast, the function of
the formula is non-obvious without including a look at the definitions, and
the result (compilability, warning messages, and actual execution results)
are highly compiler dependent.
In the former case, you have performed UNneeded casts, which make the
reason for having the casts unclear and causes potential confusion,
clutters the program unnecessarily, and makes actually needed casts
non-unique and therefore more difficult to see.
Come on, Larry, ALWAYS doesn't ALWAYS mean ALWAYS. 8)
Rick