I have read in a book that specifies this :
//: C03:SimpleCast.cpp
int main() {
int b = 200;
unsigned long a = (unsigned long int)b;
} ///:~
“Casting is powerful, but it can cause headaches because in some
situations it forces the compiler to treat data as if it were (for
instance) larger than it really is, so it will occupy more space in
memory; this can trample over other data. This usually occurs
when casting pointers, not when making simple casts like the one
shown above.”
Now can You please provide an example where casting pointer can trample other data?
Assuming
sizeof(long) > sizeof(short), and assuming the compiler putsaon the stack beforeb,bwill be trashed.