I'm not sure why somePointer would be changed given your code snippit there...
Have you considered using a template function?
1 2 3 4 5 6
template <typename T>
T inc( T& t, int incr = 1 )
{
t += incr;
return t;
}
One thing that this function does is it takes into account the type of the pointer. So if you call it with a pointer to a 16-bit value, the address is incremented in two byte multiples. If you call it with a pointer to an 8-bit value, the address is incremented in one byte multiples. For regular integers it gets incremented normally...
One thing that has always bothered me about Pascal's 'inc' procedure is that it isn't a function. It ticks me off that you have to choose 'inc' or 'succ', but not both... So my version does both... :-) (If you don't like that, just fix it to return void.)
Hope this helps.
[EDIT] You know, after all this, do you realize that you can do this directly in C++? unsignedchar value = *(somePointer += 12);