I have some old code I inherited that I am maintaining and want to change as little as possible. It does not compile with newer compilers.
There is more to the code but basically the idea, I think, (regardless how bad) is to pass a void* to the start of a table of records of arbitrary record size. I do not want to make changes outside of this function since it gets ugly. I think I just want to cast to an unsigned char* and do the addition and then cast back to void* but I am having trouble figuring out the right casting etc.
Any suggestions?
Here is the original code:
foo(const void* recordArrayBasePtr ,ubin32 sizeOfStruct)
{
void * recordPtr;
int row = 9; //for example
recordPtr = const_cast<void *>( recordArrayBasePtr ) + sizeOfStruct * row;
}