I have a library that is compiled to use 32 bit signed integer. When other applications compile theirs with a flag e.g: -DODBC64 it promotes the same type I have used in my library to a 64 bit signed integer. e.g:
#ifdef ODBC64
typedef sint64 SLEN;
#else
#define SLEN int
#endif
When the application passes reference to my library as :
SLEN count;
mylibraryfunction(&count);
the values returned to application looks like these:
sizeof(SLEN) = 8
sizeof(SLEN) in my library = 4
m_AffectedRows BEFORE = 0x3030303030303030
m_AffectedRows AFTER = 0x3030303000000000 0
You can see that the assignment from my lib is copying 4 bytes (value 0). I need to know a way to reset the upper 4 bytes to 0. e.g:
0x0000000000000000
I have tried both static_cast and reinterpret_cast, but none are helpful.
intby address to a function which interpretes it as 32 bitinttrusting it's declaration. This works as the linker cannot recognize the distinct type of equal named symbols and may link this without any warning but it's still wrong.