   Arraycasting
  Hi everyone!I have an array of the type DWORD, but a the function needs a UINT array. Can I just doDoFoo((UINT *)dwMyArray);?Or will this break something?   
  According to this page, a UINT is an unsigned int and a DWORD is an unsigned long.The safest thing to do would be to create an array of UINTs that contain the values of the corresponding elements in the DWORD array and pass those. Of course, if longs are bigger than ints on your system, you'll need to make sure the value of each DWORD fits in to a UINT.However, if you know that sizeof(UINT) == sizeof(DWORD), then the cast is probably safe in the real world. But if you do this, use a static assertion mechanism to validate this at compile time:// Assuming C++, the simplest way is:namespace {char assert_that[sizeof(UNINT) == sizeof(DWORD)]; // won't compile if sizes differ}// or use BOOST_STATIC_ASSERT, for example.and also use a reinterpret_cast to document that you're doing something that's not entirely kosher:DoFoo(reinterpret_cast<UINT *>(dwords));;  GCC uses 64-bit long, and Visual C++ uses 32-bit long as far as I know.So if you are using Visual C++ (It doesn't matter if you compile for 64-bit or 32-bit, neither GCC or Visual C++ differ in anything but pointer-sizes when compiling for x86 architectures. You should theoreticly be safe, but it is also the kind of thing that can bite you in the ass later.   ;  Okay, I transform it into an array of UINTs now. It's much safer I think after all you said.   