2012/1/5 Rico Schüller kgbricola@web.de:
char *name="test"; address may be: name -> 0x80484c4 Now what happens if the address is equal the index of another variable?
You're not really supposed to have string pointers in the first MB or so of your address space.
The detection by something like the address //((UINT_PTR)ptr) & (1 << (sizeof(UINT_PTR)*8-1))// (see http://www.winehq.org/pipermail/wine-devel/2010-April/082900.html ) may not be save either, but it is a lot better in concerns of speed and it is what some people think native does! So it might be the most compatible way to do it.
It would probably break down pretty badly on 64-bit. Nevertheless, with a handle table it's trivial to switch from one scheme to the other by simply changing the way you map table indices to handle values. (I.e. you'd just do something like adding 0x80000000 or inverting the index to get the handle.)