So I have to process some struct data which I've had to compress in a weird way for MPI_Send/Recv.
There's no way to comfortably cast it to a pointer to a known type on which I want to operate and then index along (since I've squeezed the struct into contiguous data, can't assume anything about alignment), so I have to go through it with pointer arithmetic. Problem is, to keep consistent with MPI, this data is given as void*, and pointer arithmetic on void* is illegal.
My question is mostly stylistic: is there a better way to do this than to cast to char* and then do my pointer arithmetic? What would be the efficiency considerations in taking a void*, casting to char*, doing my stuff to it, then casting back to void*? I can't imagine that pointer casts would be terribly expensive.
G'day and thankee much.