How to type-cast char* to int* in openCL-Collection of common programming errors

Stuff the pointers in a union, initialize with a char*, use it with the int*:

 union {
     char *cp;
     int  *ip;
 } ptr;

 ptr.cp = allocatedBuf;
 a[0] = *(ptr.ip);

Ugly, but does the trick without casts, at least in C. It’s undefined behaviour, but hey, you’re not using this in a heart monitor or with nuclear warheads at the other end, right?