re: Basic C Question (pointer hell)

2006-11-09 Thread Greg
I am converting from C to C++ and I did not know about reinterpret_cast. Thank you Greg -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

re: Basic C Question (pointer hell)

2006-11-08 Thread James Lin
Greg wrote: > I have a MemPtr that is as a pointer to a custom structure > (pdbLayout) > > PDBData = static_cast(MemPtrNew(size)); > > This is also the start of my data. > > I have a second pointer (Char* pOffset) that locates the > end of the data. > > How can I find the size of the data? As

Re: Basic C Question (pointer hell)

2006-11-08 Thread Jeff Loucks
If you are asking a basic 'C' question, then the following will work just fine: unsigned long size; size = (unsigned long)((char *)pOffset - (char *)PDBData) + 1; Otherwise, you are asking a basic 'C++' question, so might I recommend the following: unsigned long size; size = static_cast(reinter

Basic C Question (pointer hell)

2006-11-08 Thread Greg
I have a MemPtr that is as a pointer to a custom structure (pdbLayout) PDBData = static_cast(MemPtrNew(size)); This is also the start of my data. I have a second pointer (Char* pOffset) that locates the end of the data. How can I find the size of the data? This is not the right way --- siz