I get a lot of grief about handles. They look ugly, they can leak, they don’t produce unicorns or rainbows. Now that 64-bit builds are working, even Excel gives me grief about them.
The good news about 64-bit is that there is little new news. Basically the only thing that has changed are that pointers are now 64-bit. If you have taken a look at xll/handle.h, you will see that I just pack the pointer bits into a 64-bit IEEE double and hand that to Excel. With 32-bit pointers, that is not a problem, they can be exactly represented as an integer. Cramming 64-bit pointers into 64-bit doubles doesn’t always work out so nice.
See http://xllfloat.codeplex.com for the gory details, but not all doubles can make a round trip to Excel and back unscathed.
// 64-bit pointers might map to denormalized doubles int fpclass = _fpclass(static_cast<HANDLEX>(px.l_)); ensure (fpclass == _FPCLASS_NN || fpclass == _FPCLASS_PN);
Now if you see a popup (assuming the error flag in ALERT.FILTER
is set) about fpclass
you should think of it as winning the lottery.
I’m not sure how to fix this yet, but I’m open to suggestions.