Marcus writes:
Jerry James <james(a)xemacs.org> writes:
> Does the compile succeed if you cast to long first, then to int?
Indeed, it does. The secrets of "why" are part of the C++ standard, I
reckon. I am not even getting a warning despite the fact that casting
long to int is lossy.
The casts among ints are allowed, otherwise you'd need a new syntax
for what is a very common idiom (especially in C, which does a fair
amount of implicit coercion of function arguments to wider or narrower
types). It makes sense to warn about pointers vs integer types,
though, because the implicit assumption that pointers are the same
width as some integer type is much more likely to be violated (as I
just found out...), and less likely to be recognized since something
other than width (signedness, for example) is very likely the
conscious reason for the cast.
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta