> > Because the target variable is an (int).
>
> If I were writing the code, I would leave the cast out. By assigning
> the value to an int variable, you get the same effect anyway, so the
> cast is redundant. And if you ever change the variable to a long, now
> you have to remember to delete the cast too. So I don't see any
> upside to having the cast.
>
> But it's just a minor style issue...
I agree 100% with Roland on this one. There's a reason that compilers
don't complain about this particular cast. Casting from integer type to
integer type just isn't a big deal in my book.
Of course,I generally try to avoid casts at all costs, since they tend to
cover real issues (see all the evil casts of long* to int* that have
screwed us continually with 64 bit big endian machines.
But I don't care enough to argue the point :).
Brian
|