What’s the definition of ModuleSize? Also, you’re not showing us the
whole picture here, because the way that code is, m_PreModuleSize is an
uninitialized local variable. How is it actually set?
It is named as though it’s an (unsigned?) integer, but there’s no way to
determine what’s going on here without knowing. It might also be a
(really badly named) pointer, I suppose… but then the following code
doesn’t make a lot of sense.
Also, what is cbModSize used for *after* these lines of code? It kind of
doesn’t make sense that its a pointer, given the names of what it’s
created from.
Anyway, if I *had* to guess what was going on here, I’d guess that
ModuleSize is a pointer, m_recsize is a 32 bit integer, and the *normal*
operation of this line of code is to find some offset to the pointer.
However, if m_PreModuleSize is NULL, then I’m guessing someone earlier
on stuffed some other precomputed pointer into m_recsize (which is a
*really* bad idea), and it used to fit because m_recsize is 32 bits.
It sounds to me like this module needs to be redesigned for 64 bits,
because it appears to be a pile of spaghetti code.
xxxxx@gmail.com wrote:
Hello guys, i’m having a problem with existing code where they’ve typecasted a structure to a pointer of struct type.It worked in 32 bit mode but now in the process of porting to 64 bit,there seems to be trouble. I get the error ‘type cast’ : conversion from ‘ModuleSize’ to ‘ModuleSize *’ of greater size.I thought of every possibilty of doing the cast but couldn’t succeed.
ModuleSize* cbModSize;
ModuleSize m_PreModuleSize;
cbModSize = ( ModuleSize * )( m_PreModuleSize ? m_PreModuleSize + m_pModulePgInfo[0].m_recsize : m_pModulePgInfo[0].m_recsize );
What alternative can i implement to safely typecast the structure?
–
Ray
(If you want to reply to me off list, please remove “spamblock.” from my
email address)