There's nothing wrong with casting memory. Memory is just a bunch of bytes, it's up to you how you interpret them. It gets a little hairy when you use a C++ feature, though: inheritance. C++ has a bunch of casting operators to deal with different types of casting: static_cast, reinterpret_cast, dynamic_cast, etc...
reinterpret_cast is the same as a C-style cast, no checks, no guarantees. A static_cast will have some checks to make sure one type can be converted to the other one.
A dynamic_cast will use RTTI (Run Time Type Information) to safely cast through the inheritance chain (returns NULL if the cast is invalid). For example, a C-style cast will fail when casting between parents in a multiple inheritance situation.
In your example, I would probably ask why don't you pass a const char* ptr instead of a const void*, to avoid the cast inside the function, but there's nothing wrong with it.
As an aside, I tend to use a cast "operator" that makes it more explicit, easier to search for and doesn't break the C-style casting:
| #define cast(type) (type)
// in code...
float *array = cast(float*) AllocArray(10, sizeof(float));
|